Menu

#14 Not able to get the connection from HA-JDBC

open
nobody
5
2012-09-28
2010-01-26
Anonymous
No

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&amp;useUnicode=true&amp;characterEncoding=utf8&amp;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&amp;useUnicode=true&amp;characterEncoding=utf8&amp;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

Discussion

  • kishore valluri

    kishore valluri - 2010-01-26

    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.

     
  • Paul Ferraro

    Paul Ferraro - 2010-01-27

    Are you using Java 1.4 or 1.5? If so, read this:
    http://ha-jdbc.sourceforge.net/faq.html#faq-N10109

     
  • Paul Ferraro

    Paul Ferraro - 2010-01-27

    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

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.