I have a simple script that runs on Unix and accesses MS SQL Server. The problem I'm having is that I cannot read numeric defined datatypes. I received the following error:
com.internetcds.jdbc.tds.TdsConfused: Protocol confusion- Was expecting a lengt5
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at com.internetcds.jdbc.tds.TdsException.<init>(TdsException.java:52)
at com.internetcds.jdbc.tds.TdsConfused.<init>(TdsConfused.java:46)
at com.internetcds.jdbc.tds.Tds.getDecimalValue(Compiled Code)
at com.internetcds.jdbc.tds.Tds.getRow(Compiled Code)
at com.internetcds.jdbc.tds.Tds.processSubPacket(Compiled Code)
at com.internetcds.jdbc.tds.ResultSet_base.next(Compiled Code)
at jdbc.main(Compiled Code)
Got an exception!
Protocol confusion- Was expecting a length of 17, got 5
Here are the column defs:
Name DataType Length Value
--------------------------------------------------------------------------------------
recid numeric 18,0 12345678901
account varchar 50 00100101
Heres the script:
java.sql.Connection conn = DriverManager.getConnection(url, usr, pswd);
java.sql.Statement stmt = conn.createStatement();
ResultSet rs;
rs = stmt.executeQuery("SELECT recid, account FROM some_table"
while ( rs.next() ) {
String rec_id = rs.getString("recid"
String acct = rs.getString("account"
System.out.println("Record Id: " + rec_id);
System.out.println("Account: " + acct.trim());
}
conn.close();
} catch (Exception e) {
System.err.println("Got an exception! "
System.err.println(e.getMessage());
}
I get this message even if I don't set rec_id variable and ignore recid.
If I remove recid from Select, script executes without error..........
com.internetcds.jdbc.tds.TdsConfused: Protocol confusion- Was expecting a lengt5
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at com.internetcds.jdbc.tds.TdsException.<init>(TdsException.java:52)
at com.internetcds.jdbc.tds.TdsConfused.<init>(TdsConfused.java:46)
at com.internetcds.jdbc.tds.Tds.getDecimalValue(Compiled Code)
at com.internetcds.jdbc.tds.Tds.getRow(Compiled Code)
at com.internetcds.jdbc.tds.Tds.processSubPacket(Compiled Code)
at com.internetcds.jdbc.tds.ResultSet_base.next(Compiled Code)
at jdbc.main(Compiled Code)
Got an exception!
Protocol confusion- Was expecting a length of 17, got 5
Here are the column defs:
Name DataType Length Value
--------------------------------------------------------------------------------------
recid numeric 18,0 12345678901
account varchar 50 00100101
Heres the script:
java.sql.Connection conn = DriverManager.getConnection(url, usr, pswd);
java.sql.Statement stmt = conn.createStatement();
ResultSet rs;
rs = stmt.executeQuery("SELECT recid, account FROM some_table"
while ( rs.next() ) {
String rec_id = rs.getString("recid"
String acct = rs.getString("account"
System.out.println("Record Id: " + rec_id);
System.out.println("Account: " + acct.trim());
}
conn.close();
} catch (Exception e) {
System.err.println("Got an exception! "
System.err.println(e.getMessage());
}
I get this message even if I don't set rec_id variable and ignore recid.
If I remove recid from Select, script executes without error..........