| Author |
java.sql.SQLException: not all varaibles bound
|
Rudra Nath
Greenhorn
Joined: May 12, 2012
Posts: 9
|
|
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
Joined: Mar 17, 2011
Posts: 4761
|
|
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
|
Isn't it funny how there's always time and money enough to do it WRONG?
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5902
|
|
Also, you should be using a PS parameter for your columnvalue as well:
|
 |
Martin Vajsar
Bartender
Joined: Aug 22, 2010
Posts: 2335
|
|
|
What database and JDBC driver are you using? Sometimes approaches that work with one database/driver might fail with another.
|
 |
Wendy Gibbons
Bartender
Joined: Oct 21, 2008
Posts: 1098
|
|
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.
|
 |
 |
|
|
subject: java.sql.SQLException: not all varaibles bound
|
|
|