File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes REFCURSOR in getCursor CallableStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "REFCURSOR in getCursor CallableStatement" Watch "REFCURSOR in getCursor CallableStatement" New topic

REFCURSOR in getCursor CallableStatement

Geeta Rajgor

Joined: Jun 15, 2001
Posts: 2
I was calling a stored package procedure which was returning REFCursor (i am using oracle 8i as backend) through jdbc
was importing the Oracle JDBC drivers which support bind variables of type REFCURSOR.(classes from the oracle.jdbc.driver package)
Used the getCursor method of the CallableStatement to convert a REFCURSOR value returned by a PL/SQL block into a ResultSet.
Casting the corresponding CallableStatement to oracle.jdbc.driver.OracleCallableStatement to use the getCursor method.
The problem is this works absolutely fine if i connect as the owner of the package procedure.
but if i create a public syonym for the same package and grant execute on package to other user.
And now if i connect as this execute privilege granted user through jdbc and run the same program it gives me SQLException ora-09542 table or view does not exit.
I am just unable to understand how do i proceed in this case, as no way i can have the package procedure being created in the same user doesn't sound implementable in live environment.
I am using jdk1.3.
Please help me. I hope i have given required info to get an answer.
Geeta Rajgor

Joined: Jun 15, 2001
Posts: 2
Somehow, i got the answer of the question that i put, all those who must have gone through this question.
The answer is very simple. It is a stupid bug in oracle 8.1.6 driver which is fixed in 8.1.7 driver. Use oracle 8.1.7 driver to achieve the same.
I agree. Here's the link:
subject: REFCURSOR in getCursor CallableStatement
It's not a secret anymore!