• 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

Prepared Statement trouble

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I apologize in advance if I did not post this in the correct forum. I'm having trouble getting my prepared statement to execute properly. I have tried creating the SELECT query many different ways this is just one of them. When this method is called it prints out string from System.out.println("BEfore DB call. " + pg + " " + perPg); in my console then drops out with no data returned. In fact it appears my code cannot reach System.out.println("After DB call. "); output. I cannot get the query to execute properly.

Any help would be greatly appreciated.



 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your code is throwing a SQLException. What is it.?
 
Tom Shypulski
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm. I see no SQLException in my eclispe console it only returns test data System.out.. . The method call returns to a servlet. When I test in my browser it drops back to servlet (http://localhost/servlet/coreservlets.WebAppsServlet?pages=1&linksPerPage=5) and displays blank screen. It should return the data to servlet and depening on what it contains redirect to one of two JSP pages.
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your method throws SQLException so somewhere in your stack, it's eating it. I suggest you catch SQLException and log the error. Or you can check your log files.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
have you tried writing the query in an SQL client first?
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can bind variables into a query. The parameters you pass to the LIMIT clause aren't variables. They cannot be bound.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic