By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,492 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,492 IT Pros & Developers. It's quick & easy.

Firebird + Java ResultSet problem

P: 1
Hi, everyone. I have some problems with getting the data from ResultSet after executeQuery statement in Java. Here is my code:
try {
Statement statement = connection.createStatement();
String query = "select CITY, SHORT_NAME from airports";
ResultSet rs = statement.executeQuery(query);

Vector data = new Vector();
System.out.println(rs);
while (rs.next()){
Vector row = new Vector();
for (int i = 1; i <= 2; i++) {
System.out.println(rs.getString(i));
row.add(rs.getString(i));
}
}
rs.close();
lstAirportlist.setListData(data);
} catch (SQLException ex) {
ex.printStackTrace();
}

I'm connected to the database and can resolve column names by:
column.addElement(rs.getMetaData().getColumnName(i ));
but ResultSet (rs) contains only column names and no data inside. In database i have 3 rows of data. When making select in SQL Workbench everything runs smooth but in code when i try to print rs (and the same when set a watch) i get:

org.firebirdsql.jdbc.FBResultSet@10d9151

and it contains only 2 column labels without data.
Using firebird-full.jar and Netbeans 5.5.

I would be really thankfully if someone can get me some tips how to handle with that.
Thanks in advance.
Jun 3 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.