如何使用sql server 2008配置ha-jdbc

时间:2014-05-06 15:17:37

标签: sql-server-2008 jdbc high-availability

我正在尝试将ha-jdbc与sql server 2008一起使用.ha-jdbc cluster.xml看起来像

<ha-jdbc xmlns="urn:ha-jdbc:cluster:3.0">
<sync id="passive"/>
<state id="simple"/>
<cluster balancer="load"
 dialect="standard" default-sync="passive" transaction-mode="parallel"   
 durability="none" meta-data-cache="lazy">
<database id="db1" location="com.microsoft.sqlserver.jdbc.SQLServerDriver">
     <user>user</user>
     <password>pass</password>
     <property name="serverName">abc</property>
     <property name="portNumber">121</property>
     <property name="databaseName">dbname</property>
</database>
<database id="db2" location="com.microsoft.sqlserver.jdbc.SQLServerDriver">
     <user></user>
     <password></password>
     <property name="serverName"></property>
     <property name="portNumber"></property>
     <property name="databaseName"</property>
</database>
</cluster>

</ha-jdbc>

不确定位置标记中的内容。这是我得到的例外:

 java.sql.SQLException: class com.microsoft.sqlserver.jdbc.SQLServerDriver
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:51)
at net.sf.hajdbc.sql.SQLExceptionFactory.createException(SQLExceptionFactory.java:35)
at net.sf.hajdbc.AbstractExceptionFactory.createException(AbstractExceptionFactory.java:62)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:95)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:34)
at net.sf.hajdbc.sql.CommonDataSource.getProxy(CommonDataSource.java:85)
at net.sf.hajdbc.sql.DataSource.getConnection(DataSource.java:60)
 Caused by: java.lang.ClassCastException: class com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.lang.Class.asSubclass(Class.java:3126)
at net.sf.hajdbc.sql.CommonDataSourceDatabase.getConnectionSource(CommonDataSourceDatabase.java:81)
at net.sf.hajdbc.sql.CommonDataSourceDatabase.getConnectionSource(CommonDataSourceDatabase.java:43)
at net.sf.hajdbc.sql.DatabaseClusterImpl.isAlive(DatabaseClusterImpl.java:841)
at net.sf.hajdbc.sql.DatabaseClusterImpl.start(DatabaseClusterImpl.java:715)
at net.sf.hajdbc.util.concurrent.LifecycleRegistry.get(LifecycleRegistry.java:76)

阅读很多博客,但找不到任何解决方案。我们非常感谢任何类型的指导。

1 个答案:

答案 0 :(得分:0)

com.microsoft.sqlserver.jdbc.SQLServerDataSource为我工作。