Hi,
I'm new to HA-JDBC. And i'm writing small java test to get the connection from HA.
And thread is getting bloked at getConnection statement. Never returned any results.
<ha-jdbc>
<sync id="passive" class="net.sf.hajdbc.sync.PassiveSynchronizationStrategy"/>
<cluster balancer="load" default-sync="passive" dialect="mysql" meta-data-cache="none" transaction-mode="parallel" > <database id="first" weight="1"> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://DB03cdc.twcable.com:3306/Repoesitory?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8</url> <user>loadbalancer</user> <password>d1str1but3</password> </database> <database id="second" weight="0"> <driver>com.mysql.jdbc.Driver</driver> <url>jdbc:mysql://DB04cdp.twcable.com:3306/Repository?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8</url> <user>loadbalancer</user> <password>d1str1but3</password> </database> </cluster>
</ha-jdbc>
java>>
Class.forName("net.sf.hajdbc.sql.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:ha-jdbc:cluster", "loadbalancer", "d1str1but3");
System.out.println(connection.getMetaData().getURL());
------------Please advice on this..
Thanks
Anonymous
Here is the log>>>>>>>
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/temp/Downloads/ha-jdbc-2.0.16-rc-1/lib/runtime/slf4j-jdk14-1.5.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/temp/Downloads/ha-jdbc-2.0.16-rc-1/lib/runtime/slf4j-log4j12-1.5.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/temp/Downloads/ha-jdbc-2.0.16-rc-1/lib/runtime/slf4j-simple-1.5.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Jan 26, 2010 5:28:41 PM net.sf.hajdbc.sql.AbstractDatabaseCluster preRegister
INFO: Initializing HA-JDBC 2.0.16-rc-1 from file:/C:/NewCVSWorkspace/HATest/bin/ha-jdbc-cluster.xml
Jan 26, 2010 5:28:41 PM net.sf.hajdbc.local.LocalStateManager getInitialState
INFO: No initial cluster state found.
Are you using Java 1.4 or 1.5? If so, read this:
http://ha-jdbc.sourceforge.net/faq.html#faq-N10109
Oh - sorry - didn't read your follow-up comment. containing the "No initial cluster state found" log message.
Try clearing your local cluster state, as described here:
http://ha-jdbc.sourceforge.net/faq.html#faq-N100DB