Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error with auto-generated keys

 
Vinay Belagavi
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi when I am using the auto-generated keys in my code I am getting the following error. Can someone tell me why I am getting this error. I have also set the drivers for oracle.I am using jdk1.6, eclipse as the IDE and Oracle10g R2



The exception I am getting is

java.sql.SQLException: Invalid column type: getInt not implemented for class oracle.jdbc.driver.T4CRowidAccessor
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.Accessor.unimpl(Accessor.java:358)
at oracle.jdbc.driver.Accessor.getInt(Accessor.java:468)
at oracle.jdbc.driver.OracleReturnResultSet.getInt(OracleReturnResultSet.java:265)
at AutoGenerationKeys.AutoGenKeys.main(AutoGenKeys.java:37)

Also when I am running the program which has ParameterMetaData Class i get an exception saying Unsupported feature. Why am I getting this?



 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

Oracle does not have mysql like auto increment primary keys, you provide this using sequences in your insert statements.
But I suppose when you request generated keys with this

statement returns you rowid, which may be considered some sort of generated key and may be used to address the row in a table.

java.sql.SQLException: Invalid column type: getInt not implemented for class oracle.jdbc.driver.T4CRowidAccessor

This exception shows that on a rowid column no getInt method is implemented, since rowid is

ROWID is what is referred to a pseudo-column. It is not data in the database or table so much as it is a mapping of the location, in a specific datafile of the physical location of a row of data. Since rows can migrate from location-to-location when they are updated ROWID should never be stored an never be counted on to be the same in any database.
(from psoug)

You may try to use getString method on rowid. But you should really go after sequences.

Regards,

Fatih.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic