Advertisement

08.19.2003 at 02:39PM PDT, ID: 20714316
[x]
Attachment Details

JDBC question

Asked by cmp2 in Java Programming Language

When I query the table thome using a query tool: SELECT 2,  choice1, COUNT(choice1) FROM thome GROUP BY choice1;

It prints out:
2  books   3

When I do it inside the Java program:

sql = "SELECT 2, choice1, COUNT(choice1) FROM thome GROUP BY choice1";
Statement stmt = databaseConnection.createStatement();
stmt.execute(sql);
ResultSet rs = stmt.getResultSet();
While(rs.next()){
     System.out.println(rs.getString(2));
}

It outputs null.

If I change the sql string to use a different table in the same database it works fine.

Any ideas?Start Free Trial
[+][-]08.19.2003 at 02:56PM PDT, ID: 9184260

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.19.2003 at 06:13PM PDT, ID: 9184983

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Sign Up Now!
Solution Provided By: kimdosa
Participating Experts: 2
Solution Grade: B
 
 
[+][-]08.19.2003 at 06:16PM PDT, ID: 9184993

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.19.2003 at 06:17PM PDT, ID: 9185000

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32