Subject problems when using JayBird/Firebird from JBoss
Author Joachim Van der Auwera
I have been using JayBird/Firebid in JBoss using CMP for about two years
now. It has occasionally happened that JBoss seems to freeze. It
typically happens when there is a UserTransaction with many
records/entities in it (on some tests about 250 records).

I always thought this was a JBoss problem, but the last few days I have
been investigating a reproducable case (where it also happens with a lot
fewer records).

It seems that everything hangs when, at some point, a request from
Jaybird to the firebird instance does not respons. At this moment
nothing happens any more. The java stuff just keeps waiting for a reply.
I see no messages on either java or firebird side.

I have retried backing up and restoring the database, but that doesn't
help, so it does not appear to be db corruption.

The "crash" seems to be happening on seemingly simple select or update
statements (no joins, just selecting or updating some fields from one
record/table).

I though it might have something to do with the datasource definition,
but have now tried both

<tx-connection-factory>

<jndi-name>ICtraceDS</jndi-name>
<xa-transaction/>
<track-connection-by-tx/>
<rar-name>10firebirdsql.rar</rar-name>
<connection-definition>javax.sql.DataSource</connection-definition>
<adapter-display-name>Firebird Database
Connector</adapter-display-name>
<config-property name="database"
type="java.lang.String">localhost/3050:/data/ic-trace/smekens.fdb</config-property>
<config-property name="maxStatements">10</config-property>
<config-property name="lc_ctype"
type="java.lang.String">UNICODE_FSS</config-property>
<user-name>sysdba</user-name>
<password>masterkey</password>

<!-- pooling parameters -->
<min-pool-size>2</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>

<!-- sql to call on an existing pooled connection when it is
obtained from pool -->
<check-valid-connection-sql>SELECT CAST(1 as INTEGER) FROM
rdb$database</check-valid-connection-sql>

<track-statements>false</track-statements>
<prepared-statement-cache-size>25</prepared-statement-cache-size>

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml
(optional) -->
<metadata>
<type-mapping>Firebird</type-mapping>
</metadata>
</tx-connection-factory>

and

<local-tx-datasource>
<jndi-name>ICtraceDS</jndi-name>

<connection-url>jdbc:firebirdsql:localhost/3050:/data/ic-trace/smekens.fdb</connection-url>
<driver-class>org.firebirdsql.jdbc.FBDriver</driver-class>

<transaction-isolation>TRANSACTION_REPEATABLE_READ</transaction-isolation>
<!-- connection properties are passed in
DriverManager.getConnection(props) call -->
<connection-property name="lc_ctype"
type="java.lang.String">UNICODE_FSS</connection-property>
<connection-property name="maxStatements">10</connection-property>
<user-name>SYSDBA</user-name>
<password>masterkey</password>

<!-- pooling parameters -->
<min-pool-size>2</min-pool-size>
<max-pool-size>100</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>

<!-- sql to call on an existing pooled connection when it is
obtained from pool -->
<check-valid-connection-sql>SELECT CAST(1 as INTEGER) FROM
rdb$database</check-valid-connection-sql>

<track-statements>false</track-statements>
<prepared-statement-cache-size>25</prepared-statement-cache-size>

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml
(optional) -->
<metadata>
<type-mapping>Firebird</type-mapping>
</metadata>
</local-tx-datasource>

Both have the same result (though the local-tx-datasource seems slower.


Anybody any ideas what could be the problem or how it could be fixed ?

Thanks,
Joachim