• 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
Sheriff
Posts: 36003
422
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
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!