wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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).]
 
 
subject: NullPointerException with stmt.executeUpdate
 
Similar Threads
how to run code in netbeans
ClassNotFoundException generated!
No Suitible Driver Error
Only one chinese charcter '塚' cant able to insert by JDBC
Access to the Oracle database using Java Applets