3 Replies Latest reply on Nov 18, 2005 6:51 PM by adrian.brock

    Problems under WrappedCallableStatement

    jj_andrade

      I am trying doing a simple connection by JNDI Datasource below:

      ***************Code************************
      Context ctxt = new InitialContext();
      DataSource ds = (DataSource) ctxt.lookup("java:ds/SigomDS");
      connection = ds.getConnection();
      String sql = "{call pck_aplicacao.up_obterAplicacoes(?)}";
      cstmt = connection.prepareCall(sql);
      cstmt.registerOutParameter(1, OracleTypes.CURSOR);
      cstmt.execute();
      ResultSet cursor = ((OracleCallableStatement)cstmt).getCursor(1);
      while(cursor.next()){
      System.out.println(cursor.getString(3));
      }

      cursor.close();

      *************************End code***************

      When i am trying cast "cstmt" to OracleCallableStatement, ocurring the mistake below:
      java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrappedCallableStatement

      However, i use DataSource as shown below, all is right, someone could help me?? Why i cant cast???

      ************* I dont have problem using the code below *******

      OracleDataSource ods = new OracleDataSource();
      ods.setDriverType("thin");
      ods.setServerName("10.71.225.244");
      ods.setDatabaseName("PROJ9i");
      ods.setPortNumber(new Integer("1521").intValue());
      ods.setUser("sigom");
      ods.setPassword("sigom");
      connection = ods.getConnection();