Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Sybase IQ: TDS Protocol error: Invalid packet type

Help
2014-07-03
2014-07-03
  • Robert Brown
    Robert Brown
    2014-07-03

    I'm getting the above error when connecting to Sybase IQ.

    Sybase IQ/15.4.0.3019/120816/P/ESD 2/Enterprise Linux64 - x86_64 - 2.6.18-194.el5/64bit/2012-08-16 10:48:47

    Sample code (JRuby):

        require 'java'
        require 'jtds-1.3.1.jar'
    
        driver = Java::JavaClass.for_name('net.sourceforge.jtds.jdbc.Driver')
        url = 'jdbc:jtds:sybase://server:5019/database'
        puts "About to connect..."
        con = java.sql.DriverManager.getConnection(url, "me", "pass");
        statement = con.create_statement
        rs = statement.execute_query("SELECT 100, 1.234, getdate(), 'something'")
        while (rs.next)
          puts "next row..."
        end
    

    The output as follows:

    About to connect...
    next row...
    net/sourceforge/jtds/jdbc/TdsCore.java:2486:in `nextToken': java.sql.SQLException: TDS Protocol error: Invalid packet type 0x9
            from net/sourceforge/jtds/jdbc/TdsCore.java:805:in `getNextRow'
            from net/sourceforge/jtds/jdbc/JtdsResultSet.java:611:in `next'
            from iq2.rb:40:in `(root)'
            from iq2.rb:40:in `(root)'
    Caused by:
    TdsCore.java:2475:in `nextToken': net.sourceforge.jtds.jdbc.ProtocolException: Invalid packet type 0x9
            from TdsCore.java:805:in `getNextRow'
            from JtdsResultSet.java:611:in `next'
            from null:-2:in `invoke0'
            from null:-1:in `invoke'
            from null:-1:in `invoke'
            from null:-1:in `invoke'
    <snip>
    

    Interestingly, if I don't select a varchar value (i.e. just numbers and dates, remove 'something' value from above example) then everything is fine.

    I am using 64 bit Java, but the problem also occurs using 32 bit.

    jruby 1.7.13 (1.9.3p392) 2014-06-24 43f133c on Java HotSpot(TM) 64-Bit Server VM 1.7.0_51-b13 [Windows 7-amd64]
    

    Any tips?

    Thanks,