File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Exception: Data not found using JDBC" Watch "Exception: Data not found using JDBC" New topic

Exception: Data not found using JDBC

Brad Thiru

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

Martin Vajsar

Joined: Aug 22, 2010
Posts: 3733

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

Joined: Oct 13, 2005
Posts: 46352
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!
I agree. Here's the link:
subject: Exception: Data not found using JDBC
It's not a secret anymore!