File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes java.sql.SQLException: ORA-01006: bind variable does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: ORA-01006: bind variable does not exist" Watch "java.sql.SQLException: ORA-01006: bind variable does not exist" New topic
Author

java.sql.SQLException: ORA-01006: bind variable does not exist

Eva Chow
Greenhorn

Joined: Oct 08, 2012
Posts: 5
Hi,

I am learning JDBC. I copied an example from a web site, but when I ran it, I got the error java.sql.SQLException: ORA-01006: bind variable does not exist.
After looking at the code myself, I noticed that the line "ResultSet rs = stmt.executeQuery(sql);" is causing the problem. But I cannot tell what is wrong with this statement.


Here is the code.

Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

Hi Eva,

Welcome to JavaRanch!

The problem comes when you reuse your prepared statement as an ordinary statement. You should close stmt, and then create a new statement with Connection.createStatement() to execute your static SQL.
Eva Chow
Greenhorn

Joined: Oct 08, 2012
Posts: 5
Thanks. I took your suggestion and it's working now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: ORA-01006: bind variable does not exist
 
Similar Threads
Not to execute console based jdbc application
Need help with my first JDBC program
How to create SQL server2005 database on remote machine using jdbc?
JDBC: What is the concrete class that implements the jdbc interfaces
Servlet is not working