We are experiencing a very strange and annoying bug with JTOpen (v7.1, but was also present in previous versions).
While doing update/insert operations, we get the following error:
11:47:57,261 ERROR [STDERR] Caused by: java.sql.SQLException: [SQL0311] Length in a varying-length or LOB host variable not valid.
11:47:57,261 ERROR [STDERR] at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
11:47:57,261 ERROR [STDERR] at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
The problem is that the reported error is clearly not correct (we can repeat the insert/update with the same data and everything works fine).
After such an error occurs, the connection is in a 'corrupted' state, i.e. the selects work, but the update/insert always return the SQL0311 error.
Restarting the server (we use JBoss) and thus getting a new connection fixes the problem.
This problem is more evident when there intense activity on the DB (which points on a bug in the DB), and seems to be mitigated by limiting the lifetime of a connection (whci points on a bug in the JTOpen).
Can anyone help?
JDBC Classname: com.ibm.as400.access.AS400JDBCDriver
Database Product Version: 05.04.0000 V5R4m0
Database Product Name: DB2 UDB for AS/400
Database Major Version: 5
Driver Version: 9.2