Subject RE: [Firebird-Java] Re: RC3
Author Евгений Путилин
Hi Roman Rokytskyy
> > This is Firebird feature. It have commitRetain, after commit all
> > ResultSet is open.

>Right, but JDBC does not define commit retaining. Connection.commit()
>means isc_commit_transaction and not isc_commit_retaining. Check JDBC
>specification.
Сгласен, но говоритли JDBC, о не закрытии ResultSet при вызове commit?

> > I patch local source next files to resolve this problem
> > org\firebirdsql\jdbc\FBConnection.java
> > org\firebirdsql\jca\FBLocalTransaction.java
> > org\firebirdsql\jca\FBManagedConnection.java
> > org\firebirdsql\jca\FBManagedConnectionFactory.java

> What problem are you trying to solve?
Not find All support of FirebirdApi

Отсутсвие полной поддержки API, и реализации специфических для FB/IB решений. Например сильно хочеться такая возможность как возможность 1 транзакции для нескольких баз. Или несколько транзакций для одной базы.

>PreparedStatement should be prepared once and used many times. JDBC
>driver does not have PreparedStatement pool and will not have any.
>This feature usually is implemented in JDBC connection pool. PoolMan
>has it, I have it in my pool too (most likely I will contribute my
>pool to the project after release).

> > Example bad code
> > .....
> > {
> > PreparedSatement ps=conn.PrepareStatment(" select count(*) from
> > rdb$database");
> > ResultSet rs=ps.executeQuery();
> > while(rs.next)
> > {
> > System.out.println(rs.getInt(1));
> > }
> > }

> As you write, this is a bad code, or more correctly, buggy code. You
> have to close prepared statement after use.
it is complex if I have diferent code to prepared and use statment, particularly in MultiThread App.
> However, JayBird has some
> protection against this: all statements will be closed automatically
> when connection is closed.
I see it in FBConnection.freeStatements()
Manual call this, is crash FBConnection. And don't close on garbage collenction.

Да, но это очень сложно отследить для приложения которое в разных местах препарирует и использует этот statment. При этом теряется возможность автоматического закрытия, в момент сборки мусора.

{
PreparedSatement ps=conn.PrepareStatment(" select count(*) from
rdb$database");
ResultSet rs=ps.executeQuery();
while(rs.next)
{
System.out.println(rs.getInt(1));
}
}
System.gc();
....
//On garbage collection PreparedStatment is closed()
...

If FBConnection have soft link on FBPreparedSatement, this do;