wood burning stoves*
The moose likes JDBC and the fly likes Reading multple columns in 1 query. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Reading multple columns in 1 query." Watch "Reading multple columns in 1 query." New topic
Author

Reading multple columns in 1 query.

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
I'm attaching to an Access 2000 database on a shared mapped drive and can pull 1 column in at a time through my SQL statement. I have to execute a separate SQL call for each column, which seems to be a waste. I want to be able to pull in and show all the fields in each row.
What do I do to show both / all of the columns in each row?


(I'm just trying to get a handle on this, so I know this application doesn't make sense yet....)
Thanks in Advance!
[ February 18, 2004: Message edited by: Sam Smoot ]

CNSS/NSA Infosec Professional,<br />Software Engineer
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

This could be your problem, unless SQL Server allows this!
String SQL="SELECT FirstName LastName FROM TeamInfo";
the missing comma between FirstName and LastName.
Try changing it to
String SQL="SELECT FirstName, LastName FROM TeamInfo";


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
DUHHHHHHHH!!!
That fixed it...
I gotta quit running in mixed mode and stick to one thing...
Thanks!
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

no worries, mate.
cases like this, sometimes you can debug by trying to use PreparedStatement instead of Statement. cheers
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

And if you want all the columns you can just use SELECT * FROM ...


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading multple columns in 1 query.
 
Similar Threads
how to connect to oracle db table through java program using unix shell script?
program error
Event in jButton
Invoking ODBC database source administrator component of windows
javabean problem