This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Invalid Descriptor Index Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invalid Descriptor Index" Watch "Invalid Descriptor Index" New topic
Author

Invalid Descriptor Index

Paras Ahuja
Ranch Hand

Joined: May 22, 2012
Posts: 62


I am getting this error.
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid descriptor index

I have used the same code so many times, i never got this error. But now suddenly it doesn't work.
Please help
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

In JDBC, all numberings start at one. This is terribly unfortunate design decision, but at least it is consistent across the whole JDBC API. It therefore applies to ResultSetMetaData.getColumnName() too; you're trying to access column at index 0, which does not exist.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Invalid Descriptor Index