File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 3610
    
  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: 39478
    
  28
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Exception: Data not found using JDBC