0

I thought I should give the new extended varchar2 limits in my Java application. Here's what I've done so far:

  1. Changed MAX_STRING_SIZE to EXTENDED according to the recommended procedure.
  2. Extended the column in question to 32767 characters.
  3. Ran the program.

Java call ResultSet.updateString( str, idx ) runs fine, but when I come to ResultSet.updateRow(), I end up in a Java exception referring to an Oracle error:

java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column

Complete error stack (or at least the part that doesn't refer to my code) follows:

java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:947)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3462)
at oracle.jdbc.driver.UpdatableResultSet.executeUpdateRow(UpdatableResultSet.java:3317)
at oracle.jdbc.driver.UpdatableResultSet.updateRow(UpdatableResultSet.java:2281)

As far as I can reckon, this should be it. But either I have forgotten something fundamental, or this must be a bug (perhaps in the jdbc library).

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
  • which character set are you using in your database ? in UTF8 Latin 1 characters are expanded and the total size is increased. Example: You will see the string length is 32 characters but when encoded using UTF8 the size increases to 34 characters. Please confirm this setting and provide a table description + a row update example. – Daniel Vukasovich May 07 '15 at 00:59
  • I have managed to dig further into the error message causes, and ended up with a ora-24920 error. I am using sqldeveloper and other java based tools, so it seems to me that the problem is java or jdbc related, and not sql.
    It is most likely related to this thread [link](http://stackoverflow.com/questions/24829223/ora-24920-but-text-is-shorter-than-column-size)
    – Roald Andresen May 07 '15 at 09:39

1 Answers1

1

You must use the JDBC driver from 12c.

Jean de Lavarene
  • 3,461
  • 1
  • 20
  • 28