3 Replies Latest reply: Jun 5, 2014 10:32 AM by Joe Weinstein-Oracle RSS

    ojdbc jar issue due to server upgrade

    girinivas

      Hi,

      We recently upgraded from weblogic 10.3.2 (has ojdbc6.jar version 11.1.0.7.0) to 10.3.6 (has ojdbc6.jar version 11.2.0.3.0). 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.

       

      11.1.0.7.0 version reports it to be Sql exception 'cursor is closed' at the time of callablestatement.getObject. 11.2.0.3.0 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 11.2.0.3.0 not reporting a sql exception 'cursor is closed'? Is this a bug with that version?

       

      Thanks

        • 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
            girinivas

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

             

            Code:

             

            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
            cs.execute();
            
            
            rs = (ResultSet) cs.getObject(2);
            
            
            // loop through results set
            if (rs.next()) {
            ....
            }
            
            
            
            
            
            
            
            
            
            



            ojdbc6.jar version 11.1.0.7.0:

            SQLException is thrown at line 17.

             

            ojdbc6.jar version 11.2.0.3.0:

            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 11.2.0.3.0 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.

             

            Thanks

            • 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.