PreparedStatement.close()
PreparedStatement.close()
От:
Felipe Schnack <felipes@ritterdosreis.br>
Дата:
I have a class with lots of preparedstatements, all server-side prepared. In a very specific situation, a preparestatement was created, but the query was never actually executed (read: executeUpdate() or query() were never invoked). Then, when I tried to close the statement an error was thrown: "STATEMENT JDBC_STATEMENT_13 NOT FOUND". Obviously this happens because the statement was never prepared :-) -- Felipe Schnack Analista de Sistemas felipes@ritterdosreis.br Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br ritter@ritterdosreis.br Fone/Fax.: (51)32303341
Re: PreparedStatement.close()
От:
Barry Lind <blind@xythos.com>
Дата:
Felipe,
In a browse of the code I don't see what is wrong with the code. The
close method in AbstractJdbc1Statement has the following code:
if (m_useServerPrepare && m_statementName != null)
{ ((AbstractJdbc1Connection)connection).ExecSQL("DEALLOCATE " +
m_statementName);
}
and m_statementName is only ever assigned a value if the prepared
statement is actually executed (it is assigned in the execute method).
So I don't understand how what you are describing is possible.
Can you provide a simple test case that demonstrates the problem?
thanks,
--Barry
Felipe Schnack wrote:
> I have a class with lots of preparedstatements, all server-side
> prepared.
> In a very specific situation, a preparestatement was created, but the
> query was never actually executed (read: executeUpdate() or query() were
> never invoked). Then, when I tried to close the statement an error was
> thrown: "STATEMENT JDBC_STATEMENT_13 NOT FOUND". Obviously this happens
> because the statement was never prepared :-)
>