Subject Re: [Firebird-Java] resultset.next() returning false
Author Catalin Florean
Hi,

With only one record after rs.next() you reached the end of table.
What does rs.getstring(column_number) return?

This is a working example of a select statement on a single row table:

stmt = conn.prepareStatement("select cast(current_timestamp as
date), cnt_acte, "+
"gen_id(seq_query_log, 0),
gen_id(seq_doc_log, 0) "+
"from cnt_contor");
rs = stmt.executeQuery();
try {
if (rs.next()) {
currentDate = rs.getString(1);
cntActe = rs.getString(2);
cntQuery = rs.getString(3);
cntOpendoc = rs.getString(4);
}
}
finally {
rs.close();
rs = null;
stmt.close();
stmt = null;
}

Hope this helps,

Catalin Florean.


On 12/13/06, aravind_r1 <aravind_r1@...> wrote:
>
> I am new to firebird
> now i do have a table which has an user admin
> when i try to query the table for details of the user admin
>
> String query="select * from USER_DETAILS where USR_NAME='"+usrName+"';";
> java.sql.ResultSet rs=stmt.executeQuery(query);
> System.out.println("the result set is:"+rs.next());
>
> eventhough i has a record (when i give that query to isql i had
> obtaince the result)
>
> the rs.next is returning false
>
> so how can i get the results
>
>


[Non-text portions of this message have been removed]