Hello everybody,
I tried to reactivate some rather old Java (1.3.0) code storing an ImageIcon object in the LONG RAW field of an Oracle 7.3 table using JDBC. When I first wrote the code, it worked quite fine, but now it does not any more:
java.sql.SQLException: ORA-01483: invalid length for DATE or NUMBER bind variable
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at <my class>.writeDB(<my class>.java:239)
(...)
The code itself is a very simple PreparedStatement:
PreparedStatement ps = dbConnect.prepareStatement
("UPDATE customers SET signature = ? WHERE custID = ?");
ps.setBytes (1, bytes);
ps.setInt (2, custID);
ps.executeUpdate();
dbConnect.commit();
ps.close();
The integers used as primary keys (custID) are usually 4 or 5 digits long, whereas the DB table itself supports up to 6 digits. So what can be wrong with these integers?
I'm using the JDBC Thin Driver for Oracle8i - the driver for Oracle 7 I was originally using was quite buggy, so I had to discard it. I also tried using JDK 1.4.0, but the results were exactly the same.