This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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
Bartender

Joined: Aug 22, 2010
Posts: 2332
    
    2

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: 32708
    
    4
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: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Exception: Data not found using JDBC
 
Similar Threads
Reading an Excel file using Java
Help for Access-JDBC
The specified DSN contains an architecture mismatch between the Driver and Application
How to insert data into excel file using java code?
Readin excel files from Java & output