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.createS
tatement()
;
stmt.execute(sql);
ResultSet rs = stmt.getResultSet();
While(rs.next()){
System.out.println(rs.getS
tring(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