java.sql.SQLException: ResultSet.next was not called Oracle JDeveloper, B2B Callout

While running a Java code of B2B callout i was getting the below error. This was due to below Java code. The commented code was causing the problem then i defined it in if statement as shown below. I hope you understand the reason.

 PreparedStatement pstmt = conn.prepareStatement(“My select query=?”);
        pstmt.setInt(1, Integer.parseInt(SequenceNum));
     
   ResultSet rs = pstmt.executeQuery();
               //  TR=rs.getString(1);
              //  System.out.println(“TR is ” +TR);
      if (rs.next())
     {
                    TR=rs.getString(1);
                    System.out.println(“TR is ” +TR);
        
      }
java.sql.SQLException: ResultSet.next was not called
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_1035_WLStub.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetStub_weblogic_jdbc_rmi_internal_ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_1035_WLStub.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetStraightReader.getString(ResultSetStraightReader.java:45)
at weblogic.jdbc.rmi.SerialResultSet.getString(SerialResultSet.java:150)
at DBInserterMT100.dbInserter(DBInserterMT100.java:105)
at DBInserterMT100.execute(DBInserterMT100.java:55)
at oracle.tip.b2b.callout.CalloutExecuteWorker.doWork(CalloutExecuteWorker.java:288)
at oracle.tip.b2b.callout.CalloutExecuteWorker.run(CalloutExecuteWorker.java:258)
at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: ResultSet.next was not called
at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:2870)
at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getString(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_WLSkel.internalInvoke1(Unknown Source)
at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_oracle_jdbc_driver_OracleResultSetImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
… 2 more

Posted

in

,

by

Tags: