| Author |
SQLException : not all variables bound
|
Bhavik Patel
Ranch Hand
Joined: Jul 12, 2004
Posts: 155
|
|
I am getting SQLException while trying to insert a record in student table output: SQLException caught : not all variables bound ng an Exception while trying to add a record into a database [edited to add code tags] [ April 12, 2005: Message edited by: Jeanne Boyarsky ] [ April 14, 2005: Message edited by: Bear Bibeault ]
|
SCJP 1.4<br />SCWCD 1.4(91%)<br />Working on SCJD -Bodgitt & Scrapper Constructions...<br /> <br />"It takes 43 muscles to frown & 17 to smile but it doen't take any to just sit there with a dumb look on your face .. Keep Smiling "
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26144
|
|
Bhavik, This line of code is causing the error. For a prepared statement, you need to call the executeUpdate() method without any parameters.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Bhavik Patel
Ranch Hand
Joined: Jul 12, 2004
Posts: 155
|
|
|
Thanks Jeanne....Thank you for pointing out syntax error....i don'tunderstand why i was not getting any syntax error for that statement
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
Originally posted by bhavik patel: i don'tunderstand why i was not getting any syntax error for that statement
You will not get a syntax error because PreparedStatement interface extends Statement interface, and Statement interface has method executeUpdate(String sql) thanks
|
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
|
 |
 |
|
|
subject: SQLException : not all variables bound
|
|
|