|
/**export MS Excel sheet data to DB2 database |
*@param sourceUrl |
assign the MS Excel file location, in fact, you can assign any legal jdbc url not contains the prefix part(jdbc:excel:/), so, c:/tmp/a.xls, c:/tmp/xx.zip/aa.xls, ////192.168.10.2/sharedir/c.xls, //domain.com:3099/c:/data/b.xls all can assigned to this parameter, more about this information, please see the document. |
*@param sourceTableName |
assign the source table name |
*@param targetSchemaName |
assign the destination schema, it null, export to the current schema |
*@param targetTableName |
assign the destination table name which you want to exported to it |
*@param sourceConnPar |
assign the conntion properties, please split multi properties by ';' ,for example, username=abc;password=abc |
*/ |
|
public static void exportTable(String sourceUrl, String sourceTableName, String targetSchemaName, String targetTableName,String sourceConnPar) |
|
|
/**export SQL query result to DB2 database |
*@param sourceUrl |
assign the MS Excel file location or directory, in general, you want to export table data from a MS Excel file. In fact, you can assign any legal jdbc url not contains the prefix part(jdbc:excel:/), so, c:/tmp/a.xls, c:/tmp/xx.zip/aa.xls, ////192.168.10.2/sharedir/c.xls, //domain.com:3099/c:/data/b.xls all can assigned to this parameter, more about this information, please see the document. |
*@param querySQL |
assign the query SQL |
*@param targetSchemaName |
assign the destination schema, it null, export to the current schema |
*@param targetTableName |
assign the destination table name which you want to exported to it |
*@param sourceConnPar |
assign the conntion properties, please split multi properties by ';' ,for example, username=abc;password=abc |
*/ |
|
public static void exportQuery(String sourceUrl, String query, String targetSchemaName, String targetTableName, String sourceConnPar) |
|
|
com.hxtt.data.export.advance.ConnectionGetter.setConnection(yourConnection);
com.hxtt.data.export.advance.Excel2DB2.exportTable('c:/tmp/a.xls','ATABLE',null,'BTABLE',null);
You just supply a DB2 database connection , and then call
the method. We will release this connection after complete a export operation
for we want to avoid holding a reference to the connection . So, if you want
continue execute other export operation, you should recall the setConnection
method, for example, the code follows export two table to the target.
com.hxtt.data.export.advance.ConnectionGetter.setConnection(yourConnection);
com.hxtt.data.export.advance.Excel2DB2.exportQuery("c:/tmp","select * from aa.atable a, bb.btable b where a.id=b.id",null,"BTABLE",null); |
|