Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes error with auto-generated keys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "error with auto-generated keys" Watch "error with auto-generated keys" New topic
Author

error with auto-generated keys

Vinay Belagavi
Greenhorn

Joined: Jun 15, 2006
Posts: 29
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

Joined: Sep 01, 2005
Posts: 182
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error with auto-generated keys
 
Similar Threads
SQLXML problem
How to update a image using servlet?
Get last ID of INSERT statement
SQLException Exhausted resultset
I am getting error like ResultSet is not clled....plz help