Posted By:
Antonio_Frascella
Posted On:
Saturday, February 23, 2002 08:39 AM
Hello WAS 4.01 Application database - Oracle 8i(8.1.6) Problem: I need an instance of an OracleCallableStatement to call a stored procedure on the Oracle database. The stored procedure returns a resultset which contains the data I want. So I need to obtain a CallableStatement from a Connection object and cast it to an OracleCallableStatement. This works if I donot obtain a connection from the pool but create one using DriverManager!!! *************this works************** DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@ocl.svr.
More>>
Hello
WAS 4.01
Application database - Oracle 8i(8.1.6)
Problem: I need an instance of an OracleCallableStatement to call a
stored procedure on the Oracle database.
The stored procedure returns
a resultset which contains the data I want.
So I need to obtain a CallableStatement from a Connection object and
cast it to an OracleCallableStatement.
This works if I donot obtain a
connection from the pool but create one using DriverManager!!!
*************this works**************
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@ocl.svr.ip.addr:1521:dbna
me",
"user", "pass");OracleCallableStatement ocs =
(OracleCallableStatement)(con.prepareCall("{CALL pak.MY_Proc(?,?)}"));
*************************************************this doesn't work*********
InitialContext ic=new InitialContext();javax.sql.DataSource
ds=(javax.sql.DataSource)ic.lookup("jdbc/dbname");
Connection con=ds.getConnection("user","pass");OracleCallableStatement ocs =
(OracleCallableStatement)(con.prepareCall("{CALL pak.MY_Proc(?,?)}"));
**************************************
If i obtain a connection from the pool, I getjava.lang.ClassCastException:
com.ibm.ejs.cm.proxy.OracleCallableStatementProxy on casting the
CallableStatement to OracleCallableStatement.
Obviously we want to use pooled connections. Any ideas?
<<Less