Invalid Descriptor Index Solution

Java Programmers,

I just wanted to share a problem with you and my answer to the problem in hope that it saves you time. It took me about an hour to figure out what was going on. The problem and answer is below.

PROBLEM:

--

This error keeps occuring whenever I try to access data from a ResultSet.

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index

at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)

at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)

at sun.jdbc.odbc.JdbcOdbc.SQLGetDataFloat(JdbcOdbc.java:3136)

at sun.jdbc.odbc.JdbcOdbcResultSet.getDataFloat blah blah blah

ANSWER TO PROBLEM:

Unfortanetly, if you don't access your fields in order as they appear in the database you will get this error even if your descriptor is correct.

Hope this helps somebody,

Bruce

[914 byte] By [borntwice80] at [2007-9-27 20:06:46]
# 1
Thank you very much for posting this. I sometimes think of posting my hard-earned solutions to problems, but chicken out. You helped me a lot with this. Next time I'll think twice about doing it too!Barclay
kewpiedoll99 at 2007-7-7 0:05:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
Thank you BornT.Your message was very helpfull.I hope you keep mailing us.
yogue at 2007-7-7 0:05:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...