first commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=25
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=25
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||||
|
org.eclipse.jdt.core.compiler.release=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=25
|
||||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
|||||||
|
# Información de países
|
||||||
|
# Se muestra información del código de continente, identificador de país, nombre del país junto con su capital
|
||||||
|
"01",1, "Angola", "Luanda"
|
||||||
|
"02",62, "Brasil", "Brasilia"
|
||||||
|
"02",63, "Canadá", "Ottawa"
|
||||||
|
"02",64, "Chile", "Santiago De Chile"
|
||||||
|
"02",65, "Colombia", "Bogotá"
|
||||||
|
# Otra lista de países
|
||||||
|
"03",92, "Afganistán", "Kabul"
|
||||||
|
"03",93, "Arabia Saudita", "Riad"
|
||||||
|
"03",105, "Filipinas", "Manila"
|
||||||
|
"03",106, "India", "Nueva Delhi"
|
||||||
|
"03",136, "Vietnam", "Hanoi"
|
||||||
|
"04",147, "Bulgaria", "Sofía"
|
||||||
|
"04",152, "España", "Madrid"
|
||||||
|
"04",181, "Suecia", "Estocolmo"
|
||||||
|
# La parte final de países
|
||||||
|
"04",182, "Suiza", "Berna"
|
||||||
|
"05",185, "Australia", "Canberra"
|
||||||
|
"05",186, "Fiyi", "Suva"
|
||||||
|
"05",187, "Islas Marshall", "Majuro"
|
||||||
|
"05",196, "Tonga", "Nuku'alofa"
|
||||||
|
"05",197, "Tuvalu", "Funafuti"
|
||||||
Binary file not shown.
@@ -0,0 +1,39 @@
|
|||||||
|
package org.palomafp.aadd.npz;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public final static String nombreArchivo = "C:\\Users\\npauc\\aadd\\fic01\\informacion_paises.txt";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
leerArchivo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void leerArchivo() {
|
||||||
|
File f = new File (nombreArchivo);
|
||||||
|
if(!f.exists()) {
|
||||||
|
System.out.println("No encuentro el fichero: " + f.getAbsolutePath());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (BufferedReader br = new BufferedReader(new FileReader(f))) {
|
||||||
|
String linea;
|
||||||
|
while ((linea = br.readLine()) != null) {
|
||||||
|
linea = linea.trim(); //elimina espacios en blanco
|
||||||
|
|
||||||
|
if (!linea.isEmpty() && !linea.startsWith("#")) {
|
||||||
|
linea = linea.replaceAll("\"" , "'");
|
||||||
|
// format es para combinar texto
|
||||||
|
String sentenciaSQL = String.format("INSERT INTO T_PAIS VALUES (%s);", linea);
|
||||||
|
System.out.println(sentenciaSQL);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch(IOException e){
|
||||||
|
System.out.println("Error leyendo el fichero: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user