Subject Re: [Firebird-Java] Please help - CallableStatement only returning first row of ResultSet
Author Roman Rokytskyy
DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:D:\\Programs\\Firebird\\examples\\empbuild\\employee.fdb",
> "sysdba", "masterkey");
> CallableStatement stmt = conn.prepareCall("{call foo(?)}");

Add the following call here:

((FirebirdCallableStatement)stmt).setSelectable(true);

> stmt.setString(1, "Germany");
> ResultSet rs = stmt.executeQuery();
> while (rs.next())
> System.out.println(rs.getString(1));
> conn.close();
>
> What am I doing wrong?
> I am running FB 2.0.1, jaybird-full-2.1.1.jar, JDK 1.5.04 on Win XP Pro.

The issue is that Jaybird has no idea whether the procedure is
selectable or executable when it is specified in the escaped syntax.
System tables also do not provide such information. So, it uses EXECUTE
PROCEDURE by default. For selectable procedures developer has to provide
a hint to Jaybird to use SELECT ... FROM call instead.

Roman