5 Replies Latest reply on Aug 25, 2003 10:30 AM by rgk

    How do get Oracle Callable Statement?

    joshlam Newbie


      I am a newbie with JBoss 3.2.1 and I am using it to connect to Oracle 9.2. I have the classess12.jar in the /server/default/lib. I am using Windows XP.

      My basic configuration looks ok as I am able to execute regular SQL statements. However, I am having some problems with OracleCallableStatement.

      The way I initialize and get a connection is as follow:

      InitialContext naming = new InitialContext();
      DataSource dataSource = (DataSource)naming.lookup("java:/OracleDS");
      Connection dbConn = dataSource.getConnection();

      Now I want to get a use a CallableStatement:

      CallableStatement stmt = dbConn.prepareCall(GET_STUFF);
      stmt.setString(2, "51294691");
      stmt.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);

      In trying to get the Oracle cursor back, I got a ClassCastException with the following statement:

      ResultSet rset = ((oracle.jdbc.driver.OracleCallableStatement) stmt).getCursor(1); // ** getting ClassCast Exception

      I later wrote some code to see what the class stmt is and found out that its: org.jboss.resource.adapter.jdbc.WrappedCallableStatement

      What do I need to do so that JBoss would use the org.jboss.resource.adapter.jdbc.WrappedCallableStatement instead of its WrappedCallableStatement?