aspose file tools
The moose likes JDBC and the fly likes exception 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" Watch "exception" New topic
Author

exception

ashish sood
Greenhorn

Joined: Oct 03, 2009
Posts: 8
hello,

i am writing a simple program of jdbc




however it is generating exception
java.sql.SQLException: No data found..


please help me out with it


Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26193
    
  66

Access doesn't let you call getString() twice on the same column. Try changing the code to:



[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
sudheer yathagiri kumar
Ranch Hand

Joined: Mar 22, 2011
Posts: 31
hi,

str=rs.getString(3); here 3 means 3rd field of the table will be taken

System.out.println(str); by using this to print the value of the column and make close the connection object out side of the while loop.
while()
{

}
rs.close();
s.close();
c.close();

close the statements in reverse order .....

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: exception
 
Similar Threads
JDBC connection for DB2 database
Getting Table Name
how to improve my program code ?
How to retrieve the first record in a database table
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state