[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Error in getting Oracle CURSOR from Oracle procedure using REF CURSOR in Websphere WSAD 5

Posted on 2003-11-24
4
Medium Priority
?
662 Views
Last Modified: 2013-12-10
Hi,

I need to retrieve a OracleTypes.CURSOR in the form of java ResulstSet into my JSP page from Oracle database.

The JSP looks like:
<%@ page import = "java.sql.*" %>
<%@ page import = "oracle.jdbc.driver.*" %>
......
conn = DriverManager.getConnection(databaseURL, databaseUsername, databasePassword);
cs = conn.prepareCall("{call FIRST(?)}");
cs.registerOutParameter(1, OracleTypes.CURSOR);
cs.execute();
rs = (ResultSet) cs.getObject(1);
...........

Oracle procedure is:
.............
TYPE ref_cursor IS REF CURSOR;
CREATE OR REPLACE PROCEDURE FIRST (
 r_cursor OUT ref_cursor
) IS
BEGIN
  open r_cursor for
    select a, b, c from table;
END;

This code is giving me an error as "java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'FIRST' ORA-06550: line 1, column 7: PL/SQL: Statement ignored ", but the same code used to work perfectly in weblogic 5. Now, I am using Websphere Studio WSAD 5, Oracle 8.1.7, Oracle thin driver.

One more thing here is... when I change the OUT parameter in Oracle to VARCHAR2 and assign some value to it and in JSP if I use cs.registerOutParameter(1, OracleTypes.VARCHAR), it is working fine and giving me the result with no errors. What could be the problem? Is that the oracle.jdbc.driver.OracleTypes.CURSOR ???

Could anyone please advice me.

Thanks,
0
Comment
Question by:chandubcs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

by:justAGrl
ID: 9831906
We had a similar situation on our project(same configuration - Websphere Studio WSAD 5, Oracle 8.1.7, Oracle thin driver), working with no problems... the only difference is that we used
oracle.jdbc.OracleTypes.CURSOR not oracle.jdbc.driver.OracleTypes.CURSOR, and we have used DataSource to get db connection (with implementationClassName="oracle.jdbc.pool.OracleConnectionPoolDataSource")
0
 

Author Comment

by:chandubcs
ID: 9858465
Hi,

   I got the solution by myself. In oracle, TYPE ref_cursor IS REF CURSOR will work only with the Oracle packages. So, when I kept my oracle procedures into a package, it started working. Thanks for your comment though.

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11418449
PAQed, with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question