Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
please check this code
Jenny raj
Ranch Hand
Posts: 57
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class AuthorsInfo { public static void main(String args[]) { try { String str1 = "SELECT COLUMN1 FROM sample where id=2"; Connection con = DriverManager.getConnection("jdbc:odbc:ACCESSDSN"); Statement stmt = con.createStatement(); Resultset rs = stmt.executeQuery(str1); System.out.println("ID"); while (rs.next()) { String val = rs.getString("COLUMN1"); System.out.println(val); } con.close(); } catch (Exception ex) { System.out.println("Error occured"); System.out.println("Error:" + ex); } } }
[Edit to format code - Dave]
[ July 16, 2006: Message edited by: David O'Meara ]
Jenny raj
Ranch Hand
Posts: 57
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
please check the code and let me know where i am going wrong
below is the error message
AuthorsInfo.java:11: cannot resolve symbol
symbol : class Resultset
location: class AuthorsInfo
Resultset rs=stmt.executeQuery(str1);
^
1 error
Keith Lynn
Ranch Hand
Posts: 2412
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Check the spelling of Resultset. Remember that
Java
is case-sensitive.
Jenny raj
Ranch Hand
Posts: 57
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Corrected the Code. It is working fine now. Thanks for your reply.
David O'Meara
Rancher
Posts: 13459
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Jenny, please use the [code] tags when submitting code.
thanks,
Dave.
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
StringBuffer Object in println() function....
comparing Strings
String question
String class
.equals ( ) and ==
More...