aspose file tools*
The moose likes JDBC and the fly likes Prepared Statement Error:  not all variables bound. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Prepared Statement Error:  not all variables bound. " Watch "Prepared Statement Error:  not all variables bound. " New topic
Author

Prepared Statement Error: not all variables bound.

Shawn Walter
Greenhorn

Joined: Jan 14, 2010
Posts: 2
I get an error: Error Inserting: ORA-01008: not all variables bound

from this code:

vcQuery = "Insert into CUSTOMER.RECEIVINGDOCUMENTS ("+
"SupplierID, " +
"CIN, " +
"RecDocID, "+
"InDate "+
") values ("+
"?,"+
"?,"+
"?,"+
"?"+
")";
pstmt = conn.prepareStatement(vcQuery);
pstmt.setString(1, ps_SupplierID );
pstmt.setString(2, userCin);
pstmt.setString(3, ps_RecDocID );
odate = new java.sql.Date(dfin.parse(ps_InDate).getTime());
pstmt.setDate(4, odate);
pstmt.execute();

I have 4 variables and am binding all 4. Any help appreciated.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Perhaps this is one of those misleading error messages where column names which don't exist in the table being updated are treated by the database as "unbound variables".
Shawn Walter
Greenhorn

Joined: Jan 14, 2010
Posts: 2
Thanks for the reply.

I just checked the database, and the data is being inserted even though I am getting this error. I guess I can just trap the error and go on.

any thoughts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Prepared Statement Error: not all variables bound.