• 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 with JDBC setResult on JTextarea

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
I am trying to display a simple sql query result on a JTextArea.When I use a simple print line command I can get all data in console but when I replace the print command with append() I get these address instead of my data
com.mysql.jdbc.JDBC4ResultSet@1a16869
com.mysql.jdbc.JDBC4ResultSet@1a16869
com.mysql.jdbc.JDBC4ResultSet@1a16869
com.mysql.jdbc.JDBC4ResultSet@1a16869
com.mysql.jdbc.JDBC4ResultSet@1a16869

could you please let me know what's wrong?
Best Regards
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
'resultset' is an Object of type om.mysql.jdbc.JDBC4ResultSet. You'll have to pull the data out of the ResultSet to put in your textarea.
 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
wrong forum
 
Behrouz Hosseini
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gregg Bolinger ,
Thanks for you reply but what do you mean?
How can I do that? could you please explain me a bit more?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Might be a good idea for you to do a bit of reading up on ResultSet's and JDBC in general.

http://java.sun.com/docs/books/tutorial/jdbc/basics/retrieving.html
 
Behrouz Hosseini
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darya Akbari wrote:wrong forum


Salam Darya,

I changed the txtResult.append(resultset.next() + "\n");
but what I get in Text area is some Boolean result like false and true!
Could you please let me know what is going on here?
I am sorry about wrong forum ,as well
Thanks again
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Behrouz Hosseini,

It's clear you haven't read the link I provided. It will show you how to retrieve data from the ResultSet.
 
Behrouz Hosseini
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok I hope i can figure it out!
by the way , thanks again
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic