preparedStatement.getGeneratedKeys() exception.
[java] java.lang.NullPointerException
[java] at com.mysql.jdbc.Statement.getGeneratedKeys(Statement.java:308)
--- details below ---
MySql version: 4.0.21-nt
MySql JConnector Driver version: 3.0.15-ga
table:
create table dp_objtype
(
objtypeid int not null auto_increment,
objname varchar(64) not null,
objclass varchar(255) null,
PRIMARY KEY (objtypeid)
) type = innoDB;
statement:
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(Statement.java:308)
[java] at com.mysql.jdbc.PreparedStatement.getGeneratedKeys(PreparedSta
tement.java:538)
[java] at com.ace.db.DbHelper.insertObject(DbHelper.java:351)
If someone can tell me how to correct this, or if there is a fix for it somewhere.
thanks
-alex