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:
Abouttoconnect...nextrow...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'fromnet/sourceforge/jtds/jdbc/JtdsResultSet.java:611:in`next' from iq2.rb:40:in `(root)'fromiq2.rb:40:in`(root)'Caused by:TdsCore.java:2475:in `nextToken':net.sourceforge.jtds.jdbc.ProtocolException:Invalidpackettype0x9fromTdsCore.java:805:in`getNextRow' from JtdsResultSet.java:611:in `next'fromnull:-2:in`invoke0' from null:-1:in `invoke'fromnull:-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,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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):
The output as follows:
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.
Any tips?
Thanks,