Robert Brown - 2014-07-03

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

Sybase IQ/ 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 (
      puts "next row..."

The output as follows:

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

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?