Subject Using queries to Firebird methods
Author evgeny.timofeev
Hello, Roman

We had a talk on www.sql.ru on the subject theme.

I asked why when trying to use this code fragment

String sql = "SELECT GEN_ID(" + myGeneratorName + ", 1) FROM
RDB$DATABASE";
PreparedStatement pstat = conn.prepareStatement(sql);
ResultSet rs = pstat.executeQuery();

I had got the exception "not yet implemented".

So when I tried to use
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT GEN_ID(" +
myGeneratorName + ", 1) FROM RDB$DATABASE");

nothing changed.

But it may be my mistake as I don't sure how to get the value which
the ResultSet is likely containing now.

I wrote
if(rs.first()) someVariable = rs.getInt(1);

but JayBird threw the above exception.

How can I rather get the ResultSet value?

With best regards, Evgeny