3 Replies Latest reply on Jun 5, 2014 3:32 PM by Joe Weinstein-Oracle

    ojdbc jar issue due to server upgrade



      We recently upgraded from weblogic 10.3.2 (has ojdbc6.jar version to 10.3.6 (has ojdbc6.jar version Code fails due to the same exception scenario being handled differently between the driver versions.

      Test case is that the oracle stored procedure not able to return the open ref cursor back.

      version reports it to be Sql exception 'cursor is closed' at the time of callablestatement.getObject. returns a null Resultset object and hence results in the rs.next() Nullpointerexception.


      Why is this variation happening? Version upgrade should not have a change in the reported exceptions. Why is not reporting a sql exception 'cursor is closed'? Is this a bug with that version?



        • 1. Re: ojdbc jar issue due to server upgrade
          Joe Weinstein-Oracle

          What version is your DBMS? As to the difference in driver behavior, can you post the code you're running, from the creation of the statement to where it fails (differently in each case)?

          This may have to do with a closer adherence to the JDBC spec in the latter driver, or maybe not... I'd have to see. But I suspect the app code may need some work too...

          • 2. Re: ojdbc jar issue due to server upgrade

            DBMS version : Oracle Database 11g Enterprise Edition Release - 64bit Production




            DataSource ds = (DataSource) initCtx.lookup(jndiname);
            Connection conn = ds.getConnection();
            cs = conn.prepareCall("call procthatreturnrefcursor(?,?)");
            // set the IN parameters
            cs.setString(1, code);
            // set the OUT paramters
            cs.registerOutParameter(2, oracle.jdbc.OracleTypes.CURSOR);
            //Execute the statement
            rs = (ResultSet) cs.getObject(2);
            // loop through results set
            if (rs.next()) {

            ojdbc6.jar version

            SQLException is thrown at line 17.


            ojdbc6.jar version

            NullPointerException is thrown at line 21.


            Scenario: Stored procedure procthatreturnrefcursor returns without opening the ref cursor.


            I understand the null checking for rs will solve the issue. However, why is missing a SQLException to be thrown. My exception handling for SQLException and NullPointerException are different and hence the code fails test. I should not be fixing the code for each version of the driver upgrade.


            Appreciate your help.



            • 3. Re: ojdbc jar issue due to server upgrade
              Joe Weinstein-Oracle

              The older driver throwing an exception seems wrong. getObject() is allowed to return a null, so it looks like the app code

              just needs the clear fix, to check for null first.