我正在做这个代码,并发生了一些奇怪的事情。 我从外部文件进行批量插入。但结果只是支离破碎,或者可能已经损坏。firebird嵌入模式中的碎片行
cnx=factoryInstace.getConnection();
pstmt = cnx.prepareStatement("DELETE FROM TEMPCELULAR");
pstmt.executeUpdate();
pstmt = cnx.prepareStatement("EXECUTE BLOCK AS BEGIN if (exists(select 1 from rdb$relations where rdb$relation_name = 'EXT_TAB')) then execute statement 'DROP TABLE EXT_TAB;'; END");
pstmt.executeUpdate();
pstmt = cnx.prepareStatement("CREATE TABLE EXT_TAB EXTERNAL '"+txtarchivoProcesar.getText()+"'(CELULAR varchar(11))");
pstmt.executeUpdate();
pstmt = cnx.prepareStatement("INSERT INTO TEMPCELULAR (CELULAR)SELECT CELULAR FROM EXT_TAB");
pstmt.executeUpdate();
pstmt = cnx.prepareStatement("SELECT CELULAR FROM TEMPCELULAR");
ResultSet rs=pstmt.executeQuery();
while(rs.next()){
System.out.println("::"+rs.getString(1));
}
而现在,突然对我表中的行看起来是这样的:
::[email protected]
::[email protected]
::m
[email protected]
::.com
[email protected]
::ail.com
ab
::@gmail.com
::[email protected]
::[email protected]
::com
[email protected]
::il.com
abc
::gmail.com
::[email protected]
::
结果之间的空白不是由我做的。这是结果。对于外部表
源文件:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
¿什么是错我的代码?
我已经多年没见过这个怪人的结果。 数据库是在第一次运行时为用户pc创建的。因此,每当我运行程序时都在生产中。
任何帮助,将不胜感激。
我非常惊讶,这段代码在我的老板发表演讲前一小时工作完美。 – jRam90 2012-08-04 22:08:57
有了这个确切的代码,你总是会丢失任何字符串的前2个字符。 – 2012-08-05 08:14:38
我坚信外部表格查询应该更加详细,它应该支持不同的标记,变量长度或更多的档案,如.xls(x)文件等等。我该如何推荐给开发者? – jRam90 2012-08-14 15:40:55