I finally got my code running without jBCP errors. Basically I changed my code for jBCP by doing this:
-------------------------------------
1. one time setting:
bcp = (net.sourceforge.jtds.jdbc.BCP) java.sql.DriverManager.getConnection ("jdbc:jbcp:sqlserver://mySqlServer7:1433/myDB;charset=ISO-8859-1;domain=myDomain");
2. bulk INSERTs:
bcp.bcpInit("table1");
while() {
...
bcp.bcpSendRow(cols);
...
bcp.bcpBatch();
bcp.bcpInit();
...
bcp.bcpSendRow(cols);
...
bcp.bcpBatch();
}
//bcp.bcpDone();
bcp.bcpInit("table2");
... equivalent to table1 ...
----------------------------------------
But I get this:
--------------------
java.lang.NumberFormatException: For input string: "EUR"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at java.lang.Double.<init>(Unknown Source)
at net.sourceforge.jtds.jdbc.TdsData.writeTdsBcpCol(TdsData.java:2532)
at net.sourceforge.jtds.jdbc.TdsCore.bcpSendRow(TdsCore.java:2341)
at net.sourceforge.jtds.jdbc.BCP.bcpSendRow(BCP.java:875)
------------------------
I checked my input String[] for mixed up indices but it has no errors.
Then I tried inserting
bcp.bcpDone();
after each table bulk insert - then, no errorr occurs but also no data is saved in the database.
Found out with debugging, that on the second table, the bcp instance has "columns = 17" ... which is the number of the first table! So it seems, that subsequent tables (bcp.bcpInit("table2)) are not handled correctly, even though the value of bcp.table is correct (has the name of the second table "table2").
After inserting bcp.bcpDone(); after each table bulk insert, the error doesn't occur anymore, but nothing is saved.
1. Please update documentation to use bcpDone() beforer bcpInit() is called again with another table.
2. Why is nothing saved?