This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception: Data not found using JDBC

 
Brad Thiru
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can someone help me with the following code that displays only the first column value and with the msg as "Exception: Data not found" although i've values in the excel sheet for 6 columns.

This happens if i include the "If" stmt mentioned inside the "For" loop. But it displays all the column values properly without "If" stmt inside the "For" loop (i.e., only rs.getString(i)).

Also if I tried to display rs.getString(1); or rs.getString(2) etc... individually,but it displays ths same as mentioned above.

I'm using Eclipse for Java developers and have Windows 7 64 bit and the JDBC connection is working good. But not too sure about this.. I've doubt about the JRE.. if it requires to be re-installed.

I got bit struck on this. Any help would be greatly appreciated




REgards,
Brad
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some database drivers might require that you access columns in the resultset in an increasing order. My suggestion would be either to read all columns into local variables incrementally and then to process them, or (perhaps better) use a Java library to read Excel files (such as Apache POI or jExcel API) instead of ODBC.

And welcome to the Ranch!
 
Campbell Ritchie
Sheriff
Pie
Posts: 49456
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again
Please use the code button and avoid long lines; I have applied the code button to your post and you can see how much better it looks. On this forum (JDBC) only, you may have to disable smilies otherwise :odbc appears as dbc!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic