aspose file tools*
The moose likes JDBC and the fly likes selecting rows from a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "selecting rows from a table" Watch "selecting rows from a table" New topic
Author

selecting rows from a table

Citra Dil
Greenhorn

Joined: Mar 18, 2011
Posts: 22
Hi
I have a table 'Address' with fields: name varchar(30) ,surname varchar(30),email varchar(30),phone varchar(30)
I am writing a program to select all records from the table.Can you please tell me what is going wrong

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

how about you tell us what is happening to make you think something is wrong. then maybe we can help you work out how to fix it.
Citra Dil
Greenhorn

Joined: Mar 18, 2011
Posts: 22
I think when using getString for varchar field, I am going wrong.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

The code above is missing the result set returned from execute Query?

getString is the exact method to call on a result set for a varchar
Citra Dil
Greenhorn

Joined: Mar 18, 2011
Posts: 22
Thanks.I have modified the program with Result set.but no help.Please have a look.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

you need to find examples of how to work with a result set, as it is designed to contain more than one row (think about it, a design that could only return 1 row isn't much use).
I'm not going to type it again as there are dozens of examples out there already.

Citra Dil
Greenhorn

Joined: Mar 18, 2011
Posts: 22
Thank you Wendy.It got worked with
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: selecting rows from a table