2 Replies Latest reply on Oct 22, 2003 5:34 AM by bluebenben

    Oracle Callable Statement

    joshlam

      Hi,

      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);
      stmt.executeQuery();

      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?

      Thanks.

      --
      Josh