What does this error mean?

eric07 borg48 at hotmail.com
Fri Jan 5 03:05:18 EST 2001


Running on Windows 2000, SQL Server 2000, JDK 1.3, and FreeTDS snapshot
2.0

When I do and insert to a table and then select from it it gives me an
error:
java.sql.SQLException: Protocol confusion. Got a 0x79 packet

Here is the code to insert into the database:

			// Insert Security settings
			_strSQL =  "INSERT INTO Security( SecurityName ) VALUES ('admin' )";
      System.out.println( "\r\nAdding 'ADMIN' security" );
      ProcessSQL( _strSQL );

			_strSQL =  "INSERT INTO Security( SecurityName ) VALUES ('browse' )";
      System.out.println( "\r\nAdding 'VIEW' security" );
      ProcessSQL( _strSQL );

			_strSQL =  "INSERT INTO Security( SecurityName ) VALUES ('log' )";
      System.out.println( "\r\nAdding 'EDIT' security" );
      ProcessSQL( _strSQL );

      // Create a primary company
			_strSQL =  "INSERT INTO Company( CompanyName, SupportCompany,
CompanyDeleted ) VALUES ( 'Datalect', 1, 0 )";
      System.out.println( "\r\nAdding a defualt company" );
      ProcessSQL( _strSQL );


Which works great.  Its inserts the data appropriately.

ProcessSQL() just takes the sql statement and inserts the data.

  public boolean ProcessSQL( String strTable )
  {
    try
    {
		  Statement _stmt			= null;
      System.out.println( "\r\nProcessing [" + strTable + "] Table" );

      _stmt = _conn.createStatement();
      _stmt.execute( _strSQL );
      _stmt.close();

      return true;
    }
    catch( Exception err )
    {
       System.err.println( err );
       err.printStackTrace();

       return false;
    }
  }


But if I try to do a select on that table right after i insert it I get
that error I described above.  Here is my sql to select:

      Statement _stmt1 = null;
      ResultSet _result1 = null;

			_stmt1 = _conn.createStatement();
      _strSQL =  "SELECT SecurityID FROM Security WHERE SecurityName LIKE
'admin'";
      System.out.println( _strSQL );
			_result1 = _stmt1.executeQuery( _strSQL );
      System.out.println( "Result for Security ID" );
      if( _result1.next() )
      {
        System.out.println( "Getting Security ID" );
        _iSecurityID = _result1.getInt( "SecurityID" );
        System.out.println( "SecurityID" + String.valueOf( _iSecurityID
));
      }

      _result1.close();
			_stmt1.close();


The failure is when I try to executeQuery() is called:
_result1 = _stmt1.executeQuery( _strSQL );

Any ideas on this?

Thanks



More information about the FreeTDS mailing list