• 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

Problem in executing Query of resultset Object for JDBC Connectivity

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 10705
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic