• 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

displaying sql query results

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am trying to print the results of a simple query. ITEM is the first of four columns in my table, and is the only one I want to see the results from. But the browser only displays the basic info from the jsp code near the top of the program when I enter the url. I have marked the SELECT statement with a comment. Thanks!
The output...
MySQL-JSP, hello.delete mm.mysql.libdelete mm.mysql-2.0.3.lib
hello world
The current data and time isSun Dec 29 21:06:50 PST 2002 after DriverManager con!=null;1
after show table
con!=null;

[ December 29, 2002: Message edited by: Doug Wolfinger ]
 
Doug Wolfinger
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
nudge, nudge
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doug
It looks like you might not be getting any results from your query. Have you tried running it in the database itself to make sure it returns something?
Also, to test your code, try a simpler query, something like:
SELECT * FROM FOOD;
And make sure it is printing the results.
Another thing to do would be to test the resultset after it is returned to see if there are any items in it:

hope that helps
[ January 02, 2003: Message edited by: Dave Vick ]
 
Doug Wolfinger
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the if statement with the do-while as well as the SELECT *, but am still getting the same output. My DBTools shows me those tables have the data. What could be going wrong? Thanks again.
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Doug,
1. Check the syntex for loading the Driver and Connection
2. All HTML tags in "quotes" in out.println instead of System
Hopefully you will get some result.
Thanks
 
Doug Wolfinger
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The connection syntax was given to me by the webhost, and I'm positive that my database userid and password are correct. Should I ask the webhost what is going wrong? I'm not sure what you mean by quotes around html tags because the br tag does have quotes around it in the out.print statement.
Thanks!
 
Beauty is in the eye of the tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic