Subject Re: JayBird: Problems with Prepared Statements
Author pifproject
Hello David,
thank you for responding!

- David Johnson wrote:
> The toString() method has not overridden the default
> Object.toString() method. You will not be able to see
> the original statement by this mechanism. This is also
> typical of the commercial JDBC drivers that I have used.

Do you know if it's possible to convert the mentioned prepared INSERT
statement to String before executing it? Is there a mechanism to do
this, can I display the prepared statement as a String somehow? Or I
should do a workaround - what do you suggest?


- Original problem description:
> I am using Firebird Database Server v1.5.2 with the
> JayBird v1.5.5 JCA/JDBC driver ( more precisely the
> firebirdsql-full.jar ). I get problems with prepared
> statements, whose parameters I would like to set
> consequently. When I use:
Prepared_statement = connection.prepareStatement(String sqlCode);

> and try to see what the prepared statement is by:
Prepared_statement.toString();

> I get the following:
org.firebirdsql.jdbc.FBPreparedStatement@13a317a

> instead of a statement like:
INSERT INTO Table_name (Column_1, Column_2) VALUES (?, ?)

> which parameters I can set consequently by:
Prepared_statement.setString(1, 'SomeValue');
Prepared_statement.setString(2, 'OtherValue');

> Do you know what goes wrong in order for the connection
> not be able to prepare an INSERT statement of the kind
> shown above and how I can solve that problem? Please
> answer as soon as possible. Many thanks in advance

I would be glad to hear your opinions and suggestions.