This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes NullPointerException with stmt.executeUpdate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "NullPointerException with stmt.executeUpdate" Watch "NullPointerException with stmt.executeUpdate" New topic
Author

NullPointerException with stmt.executeUpdate

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello,
Wondering why I get a NullPointerException when executing:
stmt.executeUpdate("INSERT INTO PEOPLE (PRI,LOGIN_TYPE) VALUES ('2123','234')");
The complete code is:


[This message has been edited by Yoo-Jin, Lee (edited July 07, 2000).]
Milind Kulkarni
Ranch Hand

Joined: Jun 01, 2000
Posts: 146
Hi Lee,
Insert the following line -
Statement stmt = con.createStatement ();
before
stmt.executeUpdate("INSERT INTO PEOPLE (PRI,LOGIN_TYPE) VALUES ('2123','234')");

Also change the above line as follows:
int i = stmt.executeUpdate("INSERT INTO PEOPLE (PRI,LOGIN_TYPE) VALUES ('2123','234')");

Hope this helps !!
Regards,
Milind

[This message has been edited by Milind Kulkarni (edited July 07, 2000).]
 
Consider Paul's rocket mass heater.
 
subject: NullPointerException with stmt.executeUpdate