sbappend(enterFlag);
}
String str = sbtoString();
FileUtilitysaveStringToFile(filePath str false);
}
附录:生成import脚本代码示例:/**
* 创建装载脚本
* @param conn
* @param creator表创建者
* @param filePath
*/
public void createLoadFile(Connection connString creatorString filePath) throws Exception {
DBBase dbBase = new DBBase(conn);
String selectTableSql = select name from sysibmsystables where creator = + creator + and type=T;
try {
dbBaseexecuteQuery(selectTableSql);
} catch (Exception ex) {
throw ex;
} finally {
dbBaseclose();
}
DBResult result = dbBasegetSelectDBResult();
List list = new ArrayList();
while (resultnext()) {
String table = resultgetString();
listadd(table);
}
StringBuffer sb = new StringBuffer();
String enterFlag = \r\n;
for (int i = ; i < listsize();i++) {
String tableName = (String)listget(i);
sbappend(db \load from aa + StringvalueOf(i+)+ ixf of ixf into + tableName + COPY NO without prompting \);
sbappend(enterFlag);
}
String str = sbtoString();
FileUtilitysaveStringToFile(filePath str false);
}
附录:export脚本示例db connect to testdb user test password test
db export to aaixf of ixf select * from table
db export to aaixf of ixf select * from table
db connect reset
附录:import脚本示例db connect to testdb user test password test
db load from aaixf of ixf replace into table COPY NO without prompting
db load from aaixf of ixf replace into table COPY NO without prompting
db connect reset
[] []