Hi all
We have run into a bug with JDBC and SAP DB:
PreparedStatement inserts fail if there is more than one LONG BYTE
column in the insert list and the total number of bytes exceeds a value
just less than 64K. If there is only one column it works for any amount
of data. Here is code that demonstrates the problem:
stat.execute(
"create table test_long_byte (\n" +
" id INTEGER not null,\n" +
" a0 LONG BYTE,\n" +
" a1 LONG BYTE,\n" +
" constraint pk_test_long_byte primary key (id)\n" +
")");
byte[] a = new byte[32 * 1034];
new Random(a.length).nextBytes(a);
PreparedStatement ps = con.prepareStatement(
"insert into test_long_byte (id, a0, a1) values (?, ?, ?)");
ps.setInt(1, 1);
ps.setBytes(2, a);
ps.setBytes(3, a);
ps.execute();
This fails with the following trace:
com.sap.dbtech.jdbc.exceptions.DatabaseException:
[-3041]: Invalid position
com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:748)
com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:422)
com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:316)
com.sap.dbtech.jdbc.CallableStatementSapDB.handleStreamsForPutval(CallableStatementSapDB.java:1392)
com.sap.dbtech.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.java:410)
com.sap.dbtech.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.java:291)
Versions:
We are using the JDBC driver sapdbc.jar available from
http://www.sapdb.org/sap_db_jdbc.htm downloaded on 27th Jan 2003.
We are running SAP DB 7.3 running on RedHat Linux 6.2.
The app using JDBC is using the Sun JDK 1.4.0_01 on RedHat 8.0.
Is there a solution or workaround for this bug?
Thanks
Cheers
David
--
David Tinker - Hemisphere Technologies
JDO Genie - High performance JDO for JDBC
http://www.hemtech.co.za/jdo
Tel +27 21 670 3940 - Fax +27 21 670 3979
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general
