This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JDBC setResult on JTextarea

 
Behrouz Hosseini
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wrong forum
 
Behrouz Hosseini
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Ok I hope i can figure it out!
by the way , thanks again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic