File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes NullPointerException with stmt.executeUpdate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "NullPointerException with stmt.executeUpdate" Watch "NullPointerException with stmt.executeUpdate" New topic

NullPointerException with stmt.executeUpdate

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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 ();
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 !!

[This message has been edited by Milind Kulkarni (edited July 07, 2000).]
I agree. Here's the link:
subject: NullPointerException with stmt.executeUpdate
It's not a secret anymore!