Paul,
I am able to write basic standalone programs using ha jdbc very well.
Next, I want to integrate ha-jdbc into hibernate? how can this be done?
Also, I wanted to know how can I configure bone CP data source (connection pool) in ha jdbc xml file. Please help.
Thanks,
Syed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Paul,
In my project I am keeping all the configuration files outside the project. It is locating hibernate configuration file. But ha jdbc configuration file is not getting located even though both of them are in same folder. How to solve this problem? How I can tell hibernate that ha jdbc file is located in so and so folder?
Thanks,
Syed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The values of any "hibernate.connection.*" properties will get passed to the call to DriverManager.getConnection(String, Properties). Consequently, you can specify the path of your ha-jdbc configuration file via.
HA-JDBC will format this url using MessageFormat, allowing the name to be parameterized using the cluster identifier. e.g. file:///path/to/ha-jdbc-{0}.xml
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Paul,
I am able to write basic standalone programs using ha jdbc very well.
Next, I want to integrate ha-jdbc into hibernate? how can this be done?
Also, I wanted to know how can I configure bone CP data source (connection pool) in ha jdbc xml file. Please help.
Thanks,
Syed.
Can you attach your ha-jdbc and hibernate config, so I know from where we are starting?
okay. Here is the ha-jdbc config file.
//ha-jdbc-cluster.xml
<?xml version="1.0" encoding="UTF-8"?>
<ha-jdbc xmlns="urn:ha-jdbc:cluster:2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:schemaLocation="urn:ha-jdbc:cluster:2.1 http://ha-jdbc.github.com/xsd/ha-jdbc-2.1.0-beta-3.xsd">
<sync id="full">
<property name="fetchSize">1000</property>
<property name="maxBatchSize">100</property>
</sync>
<state id="simple"/>
<cluster balancer="load" dialect="mysql"
default-sync="full" transaction-mode="parallel"
meta-data-cache="none">
<database id="database1" location="jdbc:mysql://localhost:3306/syedsdb">
<user>root</user>
<password>root</password>
</database>
</cluster>
</ha-jdbc>
//hibernate-cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="hibernate.connection.url">
jdbc:mysql://localhost/test
</property>
<property name="hibernate.connection.username">
root
</property>
<property name="hibernate.connection.password">
root123
</property>
<mapping resource="Employee.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Waiting for your response.
Just substitute the HA-JDBC driver class name and jdbc url in your hibernate-cfg.xml.
e.g.
Paul,
In my project I am keeping all the configuration files outside the project. It is locating hibernate configuration file. But ha jdbc configuration file is not getting located even though both of them are in same folder. How to solve this problem? How I can tell hibernate that ha jdbc file is located in so and so folder?
Thanks,
Syed.
The values of any "hibernate.connection.*" properties will get passed to the call to DriverManager.getConnection(String, Properties). Consequently, you can specify the path of your ha-jdbc configuration file via.
HA-JDBC will format this url using MessageFormat, allowing the name to be parameterized using the cluster identifier. e.g. file:///path/to/ha-jdbc-{0}.xml