@Override public void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress) throws SQLException, IOException { importFile(connection, tableReference, fileName, progress, null); }
@Override public void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress) throws SQLException, IOException { importFile(connection, tableReference, fileName, progress, null); }
@Override public void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress) throws SQLException, IOException { importFile(connection, tableReference, fileName, progress, null); }
@Override public void importFile(Connection connection, String tableReference, File fileName, ProgressVisitor progress, boolean deleteTables) throws SQLException, IOException { if(deleteTables) { final boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData()); TableLocation requestedTable = TableLocation.parse(tableReference, isH2); String table = requestedTable.getTable(); Statement stmt = connection.createStatement(); stmt.execute("DROP TABLE IF EXISTS " + table); stmt.close(); } importFile(connection, tableReference, fileName, progress); }
/** * Copy data from Shape File into a new table in specified connection. * @param connection Active connection * @param tableReference [[catalog.]schema.]table reference * @param fileName File path of the SHP file or URI * @param forceEncoding Use this encoding instead of DBF file header encoding property. * @throws java.io.IOException * @throws java.sql.SQLException */ public static void readShape(Connection connection, String fileName, String tableReference,String forceEncoding) throws IOException, SQLException { File file = URIUtilities.fileFromString(fileName); if (FileUtil.isFileImportable(file, "shp")) { SHPDriverFunction shpDriverFunction = new SHPDriverFunction(); shpDriverFunction.importFile(connection, TableLocation.parse(tableReference, true).toString(true), file, new EmptyProgressVisitor(), forceEncoding); } }
/** * Copy data from Shape File into a new table in specified connection. * @param connection Active connection * @param tableReference [[catalog.]schema.]table reference * @param fileName File path of the SHP file or URI * @param forceEncoding Use this encoding instead of DBF file header encoding property. * @throws java.io.IOException * @throws java.sql.SQLException */ public static void readShape(Connection connection, String fileName, String tableReference,String forceEncoding) throws IOException, SQLException { File file = URIUtilities.fileFromString(fileName); if (FileUtil.isFileImportable(file, "shp")) { SHPDriverFunction shpDriverFunction = new SHPDriverFunction(); shpDriverFunction.importFile(connection, TableLocation.parse(tableReference, true).toString(true), file, new EmptyProgressVisitor(), forceEncoding); } }
/** * Copy data from Shape File into a new table in specified connection. * @param connection Active connection * @param tableReference [[catalog.]schema.]table reference * @param fileName File path of the SHP file or URI * @param forceEncoding Use this encoding instead of DBF file header encoding property. * @throws java.io.IOException * @throws java.sql.SQLException */ public static void readShape(Connection connection, String fileName, String tableReference,String forceEncoding) throws IOException, SQLException { File file = URIUtilities.fileFromString(fileName); if (FileUtil.isFileImportable(file, "shp")) { SHPDriverFunction shpDriverFunction = new SHPDriverFunction(); shpDriverFunction.importFile(connection, TableLocation.parse(tableReference, true).toString(true), file, new EmptyProgressVisitor(), forceEncoding); } }