Xi CHEN [
https://community.jboss.org/people/seanchenxi] commented on the document
"Data Source Configuration in AS 7"
To view all comments on this document, visit:
https://community.jboss.org/docs/DOC-16657#comment-8836
--------------------------------------------------
Hello,
I'm migrating a jboss 5 app to jboss 7.1. With this artical, I added correctly the
datasource, But I can't find how to configure a "HA DataSource" to use multi
databases. Could you help me ?
In Jboss 5, we set two url in <connection-url> to treate databse failover :
<datasources>
<local-tx-datasource>
<jndi-name>Database</jndi-name>
<use-java-context>false</use-java-context>
* <connection-url>*
*jdbc:sqlserver://<IP>:1433;databaseName=MyDB;|jdbc:sqlserver://<IP>:1433;databaseName=MyDB</connection-url>*
* <url-delimiter>|</url-delimiter>*
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<databaseName>MyDB</databaseName>
<user-name>USER_NAME</user-name>
<password>USER_PASSWORD</password>
<check-valid-connection-sql>select COUNT(*) from CLIENT
</check-valid-connection-sql>
</local-tx-datasource>
</datasources>
*But, how can we do the same thing in jboss 7.1 ?* I tried:
<datasource jndi-name="java:/CobraDatabase" pool-name="COBRAPool"
enabled="true" use-java-context="true" use-ccm="false">
*
<connection-url>jdbc:sqlserver://<IP>:1433;databaseName=MyDB;|jdbc:sqlserver://<IP>:1433;databaseName=MyDB</connection-url>*
* <url-delimiter>|</url-delimiter>*
<driver>
sqlserver
</driver>
<security>
<user-name>USER_NAME</user-name>
<password>USER_PASSWORD</password>
</security>
<validation>
<check-valid-connection-sql>
select COUNT(*) from CLIENT
</check-valid-connection-sql>
</validation>
</datasource>
<drivers>
<driver name="sqlserver" module="com.microsoft.sqlserver">
<xa-datasource-class>
com.microsoft.sqlserver.jdbc.SQLServerXADataSource
</xa-datasource-class>
</driver>
</drivers>
When I shutdown the first sql server, it can't create a new connection with the second
url...
Thank you.
--------------------------------------------------