Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLException : not all variables bound

 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34383
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bhavik,
This line of code is causing the error.


For a prepared statement, you need to call the executeUpdate() method without any parameters.
 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic