-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Jaybird connection pool
PostPosted: Mon Nov 23, 2009 3:03 am 
Newbie

Joined: Mon Nov 23, 2009 2:33 am
Posts: 5
Hello! I'm using Jaybird driver and want to use Jaybird connection pool. According driver's documentation, there are two classes: org.firebirdsql.pool.FBSimpleDataSource and org.firebirdsql.pool.FBWrappingDataSource. Both works when I write pure jdbc code. Hibernate gives me an error Could not instantiate connection provider: org.firebirdsql.pool.FBSimpleDataSource. If I remove <property name="hibernate.connection.provider_class"> it still using built-in pool.
How can use Jaybird connection pool in Hibernate?

Here is my hibernate.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.FirebirdDialect</property>
<property name="hibernate.connection.driver_class">org.firebirdsql.jdbc.FBDriver</property>
<property name="hibernate.connection.url">jdbc:firebirdsql:localhost:erpdebug</property>
<property name="hibernate.connection.username">vitaly</property>
<property name="hibernate.connection.password">1</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>
<property name="hibernate.connection.provider_class">org.firebirdsql.pool.FBSimpleDataSource</property>
<!-- Tune JayBird connection pool -->
<property name="org.firebirdsql.pool.FBSimpleDataSource.LoginTimeout">10</property>
<property name="org.firebirdsql.pool.FBSimpleDataSource.Encoding">UTF8</property>
<property name="org.firebirdsql.pool.FBSimpleDataSource.DefaultIsolation">TRANSACTION_READ_COMMITTED</property>
<property name="hibernate.connection.pool_size">1</property>

<mapping resource="breserp/VOrg.hbm.xml"/>
<mapping resource="breserp/VDept.hbm.xml"/>
<mapping class="" file="" jar="" package="" resource="breserp/VAddress.hbm.xml"/>
<mapping resource="breserp/VRank.hbm.xml"/>
<mapping resource="breserp/VPerson.hbm.xml"/>
<mapping resource="breserp/VEnergoObjects.hbm.xml"/>
<mapping resource="breserp/VNet.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject: Re: Jaybird connection pool
PostPosted: Mon Nov 23, 2009 4:41 am 
Newbie

Joined: Mon Sep 07, 2009 4:20 pm
Posts: 12
Hi,

although I do not have a working example of using Firebird with the Hibernate-provided connection pool, I will post my config for using Hibernate with a tomcat-dbcp connection pool. Hope this is useful for you.


hibernate.cfg.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

   <property name="hibernate.connection.datasource">java:/comp/env/jdbc/myDb</property>
   
   <property name="dialect">org.hibernate.dialect.FirebirdDialect</property>
   <property name="show_sql">true</property>
   <property name="hibernate.hbm2ddl.auto">none</property>

   <mapping class="lu.mind.Customer" />
   <mapping class="lu.mind. ..." />

</session-factory>
</hibernate-configuration>



context.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>

<Context debug="99">

   <Resource name="jdbc/myDb"
      auth="Container"
      url="jdbc:firebirdsql:localhost/3051:myAlias?encoding=ISO8859_1"
      username="SYSDBA"
      password="masterkey"
      type="javax.sql.DataSource"
      driverClassName="org.firebirdsql.jdbc.FBDriver"
      validationQuery="select 1 from RDB$DATABASE"
      removeAbandoned="true"
      removeAbandonedTimeout="300"
      logAbandoned="true"
      initialSize="5"
      maxActive="50"
      maxIdle="10"
      minIdle="5"
      maxWait="5000"
      testOnBorrow="false"
      testWhileIdle="false"
      timeBetweenEvictionRunsMillis="40000"
      minEvictableIdleTimeMillis="240000"
      debug="99"
   />

</Context>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.