File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: not all varaibles bound

 
Rudra Nath
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did following in JAVA:

String query = "update mytable set image=? where column1= \'" +columnvalue+"\'";
PreparedStatement st1=conn.prepareStatement(query);
st1.setBinaryStream(1,new FileInputStream(myImg),(int)myImg.length());
st1.executeUpdate();

where myImg contains full path with filename where an image is stored.

But I am getting follwoing error:
java.sql.SQLException: not all varaibles bound.

What to do?
 
Winston Gutkowski
Bartender
Pie
Posts: 9442
49
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rudra Nath wrote:But I am getting follwoing error:
java.sql.SQLException: not all varaibles bound.

It would be useful if you supply the exact error (ie, the first few lines of the stacktrace), along with an indication of precisely which line is throwing it.

However, that said, your statement looks very odd. Specifically, I'm not at all sure that you can set a BLOB with a simple '=' assignment (but I may be wrong).

Winston
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, you should be using a PS parameter for your columnvalue as well:

 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What database and JDBC driver are you using? Sometimes approaches that work with one database/driver might fail with another.
 
Wendy Gibbons
Bartender
Posts: 1107
Eclipse IDE Oracle VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin Vajsar wrote:What database and JDBC driver are you using? Sometimes approaches that work with one database/driver might fail with another.


yes blobs are vendor specific.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic