File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prepared Statement trouble

 
Tom Shypulski
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • 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.



 
Tom Reilly
Rancher
Posts: 618
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code is throwing a SQLException. What is it.?
 
Tom Shypulski
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried writing the query in an SQL client first?
 
Jan Cumps
Bartender
Posts: 2577
11
C++ Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic