• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Problem in executing Query of resultset Object for JDBC Connectivity

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing the GRAND PROBLEM in executing query from resultset object for mu JDBC work.... please help

problem appears in this statement resultset = statement.executeQuery(query);

this gives this error



This is Authors Manager Class whose method viewAuthor is facing error





and this is DBConnect Class which is Connecting and giving statement object to AuthorsManager class

DBConnect Class



 
Saloon Keeper
Posts: 10858
234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

Are you sure that the code you showed us is the compiled code that is being executed? Please clean and rebuild your project and try again. If it still doesn't work, post the entire source file, including package declaration.
 
Saloon Keeper
Posts: 5911
152
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your table really named "Table"? It's better not to use SQL keywords for names; that may well be the problem here.
 
Saloon Keeper
Posts: 21306
140
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:Is your table really named "Table"? It's better not to use SQL keywords for names; that may well be the problem here.



VERY likely. Also, I don't recommend using upper-case letters in table names, as results can be strange depending on the DBMS being used.

It's possible to name database tables - and other database resources - using reserved words, but then you have to use an "escape" mechanism so as to not confuse the SQL compiler. It's simply better to avoid those words.
 
Saloon Keeper
Posts: 6460
61
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aside from the already mentioned TABLE keyword, I believe you need to call next() on resultSet before trying to retrieve values.
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!