Subject | How to call FirebirdPool.restart() from JBoss |
---|---|
Author | Jeremy Blythe |
Post date | 2005-07-09T20:24:23Z |
I have a situation where triggers are enabled/disabled on an active database. This metadata change (in Classic server) is only updated at the client end when the connection is established. Therefore I need to close all connections in the pool and start them up again. This I believe is the purpose of the new restart() function in FirebirdPool. How can I call this from within JBoss? My firebird-ds.xml file looks like this:
<connection-factories>
<!--FBManager can be used to create and drop databases.
Drop is especially useful during testing, since it
assures a clean start next time. -->
<mbean code="org.firebirdsql.management.FBManager" name="jboss.jca:service=FirebirdManager">
<attribute name="FileName">/database/mediator.gdb</attribute>
<attribute name="UserName">sysdba</attribute>
<attribute name="Password">masterkey</attribute>
<attribute name="CreateOnStart">false</attribute>
<attribute name="DropOnStop">false</attribute>
</mbean>
<tx-connection-factory>
<jndi-name>MMX</jndi-name>
<xa-transaction/>
<rar-name>firebirdsql.rar</rar-name>
<connection-definition>javax.sql.DataSource</connection-definition>
<config-property name="Database" type="java.lang.String">localhost:/database/missing.gdb</config-property>
<user-name>sysdba</user-name>
<password>masterkey</password>
<!--additional properties. only use one way of setting tx isolation, please
<config-property name="TransactionIsolation"></config-property>
<config-property name="TransactionIsolationName">TRANSACTION_READ_COMMITTED</config-property>
<config-property name="BlobBufferLength"></config-property>
<config-property name="Encoding">UNICODE_FSS</config-property>-->
<min-pool-size>0</min-pool-size>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>-->
<!-- 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>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Firebird</type-mapping>
</metadata>
</tx-connection-factory>
</connection-factories>
Thanks in advance.
Jeremy.
<connection-factories>
<!--FBManager can be used to create and drop databases.
Drop is especially useful during testing, since it
assures a clean start next time. -->
<mbean code="org.firebirdsql.management.FBManager" name="jboss.jca:service=FirebirdManager">
<attribute name="FileName">/database/mediator.gdb</attribute>
<attribute name="UserName">sysdba</attribute>
<attribute name="Password">masterkey</attribute>
<attribute name="CreateOnStart">false</attribute>
<attribute name="DropOnStop">false</attribute>
</mbean>
<tx-connection-factory>
<jndi-name>MMX</jndi-name>
<xa-transaction/>
<rar-name>firebirdsql.rar</rar-name>
<connection-definition>javax.sql.DataSource</connection-definition>
<config-property name="Database" type="java.lang.String">localhost:/database/missing.gdb</config-property>
<user-name>sysdba</user-name>
<password>masterkey</password>
<!--additional properties. only use one way of setting tx isolation, please
<config-property name="TransactionIsolation"></config-property>
<config-property name="TransactionIsolationName">TRANSACTION_READ_COMMITTED</config-property>
<config-property name="BlobBufferLength"></config-property>
<config-property name="Encoding">UNICODE_FSS</config-property>-->
<min-pool-size>0</min-pool-size>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>-->
<!-- 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>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Firebird</type-mapping>
</metadata>
</tx-connection-factory>
</connection-factories>
Thanks in advance.
Jeremy.