Thursday, November 4, 2010

How to configure Fail-over using MySql, Hibernate and C3P0

Here is the hibernate configuration i used to implement the fail-over for MySql.
<property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost,host-address/database-name</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.cache.use_second_level_cache">false </property>

No comments: