3 Replies Latest reply on Mar 4, 2003 11:14 AM by michaeljbergin

    SQL Server Exceptions ...

    godsend

      Grettings ,

      I have installed JBOSS 3.0.4 and am attempting to connection pool using MS SQL Server 2000. I have setup the mssql-service.xml file and placed it into the deploy directory, placed the jars into the lib directory (both of them just to be sure) and I have changed both the standardjboss.xml and standardjaws.xml . Everything appears to be ok because I can do a lookup on the datasource and create a connection no problems.

      When I attempt the run the following code in one of the entity ejbs :

      try {
      InitialContext initCtx = new InitialContext();
      Connection conn = null;
      DataSource ds = (javax.sql.DataSource)initCtx.lookup ("java:/MSSQLDS");
      conn = ds.getConnection();
      Statement stmt = conn.createStatement();
      //ResultSet set = stmt.executeQuery("select count from QTracsCount");
      stmt.execute("Select * from QTracsHolder");
      ResultSet set = stmt.getResultSet();
      System.out.println (set.getRow());
      System.out.println (set.getString(1));
      conn.close();

      } catch (Exception e) {
      System.out.println(e);
      }


      I get the following output :
      0
      "Can't start a cloned connection while in manual transaction mode"

      Obviously the code is bombing out at set.getString call. Several websites suggested that I add ";SelectMethod=cursor" to my connection url, which I did. I then got the following output while running the above code :

      0
      "Invalid operation for the current cursor position"


      Ugh! Any ideas guys? Thanks.

        • 1. Re: SQL Server Exceptions ...
          godsend

          Sorry I should be more specific : The Exception output should read

          java.sql.SQLException [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation ....

          • 2. Re: SQL Server Exceptions ...
            e_jehu

            I have just hit this same problem, did you ever resolve it? any hints would be great (i'm using RC2)

            Evan

            • 3. Re: SQL Server Exceptions ...
              michaeljbergin

              i had the same problem previously. i fixed it by adding "SelectMethod=cursor" so the entire line reads:

              <config-property name="XADataSourceProperties" type="java.lang.String">ServerName=192.168.123.222:1433;SelectMethod=cursor</config-property>

              This line should be in your jca configuration file although I'm using an XA connection it should work the same with yours.