Invalid column type

hi guys,

The autoincrement id doesnt work for retrieving,

it has insert data into db. But not getting retrieved.

error-

Invalid column type: getInt not implemented for

class oracle.jdbc.driver.T4CRowidAccessor

publicvoid registerUser(String name, String title, String email,

Integer telephone, String userName, String password)throws DaoException{

String addUser =

"insert into users(name,title,email,telephone,userName,password) values(?,?,?,?,?,?)";

try{

System.out.println("-getting datasource for connection-");

getDataSource();

if(conn ==null){

conn = dataSource.getConnection();

System.out.println("--got connection from pool-");

}

if(conn!=null){

System.out.println("-about to execute insert stmt--");

ps = conn.prepareStatement(addUser,PreparedStatement.RETURN_GENERATED_KEYS);

ps.setString(1,name);

ps.setString(2,title);

ps.setString(3,email);

ps.setInt(4,telephone);

ps.setString(5,userName);

ps.setString(6,password);

ps.executeUpdate();

/*

* get the ResultSet object

*/

if(rs ==null){

rs = ps.executeQuery();

rs = ps.getGeneratedKeys();// stores generated keys for retrieving autoIncrementKey

try{

if(rs.next()){

int prikey = rs.getInt(1);

System.out.println(prikey);

}

}

catch(SQLException e){

thrownew DaoException("Error retrieving autoIncrementKey",e);

}

}

Any ideas?

Tnx

[2628 byte] By [goodprograma] at [2007-11-27 2:40:46]
# 1

Oracle (and PostgreSQL) does not support getGeneratedKeys() as they uses a separate table for the ID sequence.

By default the sequence table is called "schemaname.tablename_id_seq" and you can retrieve the last inserted ID bySELECT currval('schemaname.tablename_id_seq')

it returns an Integer or a Long, depending on the implementation.

BalusCa at 2007-7-12 3:03:56 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...