This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Exception: Data not found using JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Exception: Data not found using JDBC" Watch "Exception: Data not found using JDBC" New topic
Author

Exception: Data not found using JDBC

Brad Thiru
Greenhorn

Joined: Mar 14, 2013
Posts: 2
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

Joined: Aug 22, 2010
Posts: 3606
    
  60

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

Joined: Oct 13, 2005
Posts: 38087
    
  22
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!
 
wood burning stoves
 
subject: Exception: Data not found using JDBC
 
Similar Threads
Reading an Excel file using Java
The specified DSN contains an architecture mismatch between the Driver and Application
How to insert data into excel file using java code?
Help for Access-JDBC
Readin excel files from Java & output