• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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: 14497
325
  • 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: 7488
171
  • 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: 26275
186
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: 9724
80
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • 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.
 
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic