9 Replies Latest reply on Sep 4, 2002 12:09 PM by Dain Sundstrom

    Microsoft SQLServer ResultSet can not re-read row data for c

    Ravi Goorah Newbie

      Hi, I'm using the Microsoft SQLServer JDBC Driver and I'm getting the following error:
      [Microsoft][SQLServer JDBC Driver]ResultSet can not re-read row data for column 1.

      As far as I can tell it's because Jboss puts the columns in the select statement in some order. Then uses the resultSet to read the columns in a different order than in the select statement. Has anyone else experienced this problem? Could someone point me to the sections of code that create the select statement and read the resultset?
      Thanks.

        • 1. Re: Microsoft SQLServer ResultSet can not re-read row data f
          Bani Greyling Newbie

          Hi rcgoorah

          I experience the same problem. Did you find a solution to the problem?

          Regards

          • 2. Re: Microsoft SQLServer ResultSet can not re-read row data f
            Dain Sundstrom Master

            This is a JAWS only problem, right?

            • 3. Re: Microsoft SQLServer ResultSet can not re-read row data f
              Bani Greyling Newbie

              Not sure. If I use the JSQLConnect driver from from j-netdirect, all is well, but if I use microsoft's driver for SQLServer2000, I get the exception. I tried the different drivers with something simple to try and reproduce the exception:

              Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
              Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://DevDist:1433;user=uname;password=pass;databaseName=SettingDB;selectMethod=cursor");

              // Class.forName("com.jnetdirect.jsql.JSQLDriver");
              // Connection conn = DriverManager.getConnection("jdbc:JSQLConnect://DevDist/database=SettingDB/user=umane/password=pass");

              // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              // Connection conn = DriverManager.getConnection("jdbc:odbc:SettingDB","uname","pass");

              Statement stmt = conn.createStatement();
              // ResultSet rs = stmt.executeQuery("Select * from emailtemplate");
              ResultSet rs = stmt.executeQuery("Select * from emailaddress");
              while (rs.next()) {
              System.out.println(rs.getString(1));
              System.out.println(rs.getString(1));
              }

              The table emailTemplate have a column of type text(which can take more than 256 chars).
              ex = Exception
              no-ex = no exception
              emailtemplate emailaddress
              MSSQL ex no-ex
              ODBC ex ex
              JSQL no-ex no-ex

              I suspect it is a driver issue, but if jboss (jaws) would be able to work around this problem, that would be mighty nice. Here is a stacktrace to better define the problem:
              ava.sql.SQLException: [Microsoft][SQLServer JDBC Driver]ResultSet can not re-read row data for column 1.
              at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
              at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
              at com.microsoft.jdbc.base.BaseResultSet.validateColumnIndex(Unknown Source)
              at com.microsoft.jdbc.base.BaseResultSet.getObject(Unknown Source)
              at org.jboss.pool.jdbc.ResultSetInPool.getObject(Unknown Source)
              at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultObject(JDBCCommand.java:401)
              at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getResultObject(JDBCCommand.java:500)
              at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneEntity(JDBCLoadEntityCommand.java:219)
              at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.handleResult(JDBCLoadEntityCommand.java:176)
              at org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult(JDBCQueryCommand.java:59)
              at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:156)
              at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:147)
              at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistenceManager.java:156)
              at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:362)
              at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:287)
              at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:197)
              at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:125)
              at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138)
              at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
              at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
              at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
              at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
              at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:428)
              at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:410)
              at java.lang.reflect.Method.invoke(Native Method)
              at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
              at sun.rmi.transport.Transport$1.run(Unknown Source)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.rmi.transport.Transport.serviceCall(Unknown Source)
              at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
              at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)

              • 4. Re: Microsoft SQLServer ResultSet can not re-read row data f
                Bani Greyling Newbie

                Sorry, I meant to preview my previous post...

                ...continueing....

                Would you rather suggest I get the CMP2.0 engine up and running in JBoss-2.4.4 to resolve this issue? If so, how is that done?

                Regards

                • 5. Re: Microsoft SQLServer ResultSet can not re-read row data f
                  Dain Sundstrom Master

                  This is a JAWS problem. (you can tell because it has jaws in the stack trace)

                  > Would you rather suggest I get the CMP2.0 engine up
                  > and running in JBoss-2.4.4 to resolve this issue? If
                  > so, how is that done?

                  CMP 2.0 only runs in JBoss 3.0.

                  I don't think that JBossCMP rereads columns.

                  • 6. Re: Microsoft SQLServer ResultSet can not re-read row data f
                    cgd Newbie

                    Has somebody found a solution for this problem ?

                    • 7. Re: Microsoft SQLServer ResultSet can not re-read row data f
                      Cezary Zawadka Newbie

                      This is what i've found at microsoft.public.sqlserver.jdbcdriver:
                      "The problem will be with data types such as IMAGE or any long datatypes. What happens here is if you are using any data types which contains long data the driver opens pointer to that buffer instead of storing that data in the local buffer. So If your SELECT list contains any long data columns(text, ntext, image) then you will not be able to reread data in the resultset based on the current driver implementation. So the simple work around is to process the result in order or to avoid longdata columns when you do not want them in current logic"
                      You can see that post here http://groups.google.com/groups?hl=en&selm=wKuudyd9BHA.2252%40cpmsftngxa08
                      And yet another:
                      "The above error happens if you attempt to re-read a ResultSet column or read a column less then the last column read.
                      This can be over come if you use conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDA
                      TABLE) instead of the default createStatement(). The reason is that that default generates TYPE_FORWARD_ONLY ResultSets."
                      http://groups.google.com/groups?selm=96wm8.227998%24Dl4.25981017%40typhoon.tampabay.rr.com&hl=en

                      • 8. Re: Microsoft SQLServer ResultSet can not re-read row data f
                        pol.leleux Newbie

                        Hello all,

                        how can I solve the problem if I am using CMP ? I don't want to write a BMP just to handle my BLOB field since I also use CMR to manage my relationships...