preparedStatement.getGeneratedKeys() exception.
Posted by: Alex Cheung
Date: November 04, 2004 11:39AM

[java] java.lang.NullPointerException
[java] at com.mysql.jdbc.Statement.getGeneratedKeys(

--- details below ---

MySql version: 4.0.21-nt
MySql JConnector Driver version: 3.0.15-ga


create table dp_objtype
objtypeid int not null auto_increment,
objname varchar(64) not null,
objclass varchar(255) null,
PRIMARY KEY (objtypeid)
) type = innoDB;

PreparedStatement pstmt = conn.preparedStatement("insert into dp_objtype (objname, objclass) values (?,?)", Statement.RETURN_GENERATED_KEYS);

If I use pstmt.execute(), the insert-stmt executed without any problem. If I use pstmt.getGeneratedKeys(), I get the following Exception:

[java] psqlstmt = insert into dp_objtype (objname, objclass) values (?,?)
[java] set val[1] = user
[java] set val[2] = com.datapipes.db.User
[java] java.lang.NullPointerException
[java] at com.mysql.jdbc.Statement.getGeneratedKeys(

[java] at com.mysql.jdbc.PreparedStatement.getGeneratedKeys(PreparedSta
[java] at com.ace.db.DbHelper.insertObject(

If someone can tell me how to correct this, or if there is a fix for it somewhere.


Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.