Subject Fragmented rows in firebird embedded mode
Author joecs6
I was doing this code, and something weird has happened. I make a bulk insert from an external file. But the result it's just fragmented, or maybe corrupted.

Code:

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));
}
End of code.


And now, all of a sudden the rows on my table look like this:

::c@...

::abc2@gmail.

::m
abc3@gma

::.com
abc4@

::ail.com
ab

::@...


::bc6@gmail.c

::abc7@gmai

::com
abc8@g

::il.com
abc

::gmail.com

::c10@gmail.c

::

The blank spaces between results were not made by me. This is the result as it is.

Source file for external table (Plain .txt):

abc@...
abc2@...
abc3@...
abc4@...
abc5@...
abc6@...
abc7@...
abc8@...
abc9@...
abc10@...
sneciosup@...

¿What's wrong with my code?

I've haven't seen this wack results in years. The database is created of the users pc on the first run. Hence, while in production every time I run the program.

This was done with Java 7 and Firebird Embedded Edition 2.5

I' ve cheked every query, and it goes wrong in the part where I create the external table: "CREATE TABLE EXT_TAB EXTERNAL '"+txtarchivoProcesar.getText()+"'(CELULAR varchar(11))". The external table output varies according to the data type and it's length, so if you put varchar(300) or varchar(50) then the output will vary a lot. Gee, I mean one hour before my presentation with my boss this was working ok...

Any help, will be appreciated.