Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7949741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:04:05+00:00 2026-06-04T02:04:05+00:00

In JBoss data source how can I give multiple connection strings for database fail

  • 0

In JBoss data source how can I give multiple connection strings for database fail over in which I want .

There will be two Mysql db with same tables say DB1 and DB2. I want to insert data to DB1, if DB1 is down, then I need to insert it into DB2. During inserting into DB2 if the DB1 comes up I need to insert rest of the data into DB1. How can I configure this in my JBoss?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:04:06+00:00Added an answer on June 4, 2026 at 2:04 am
    <?xml version="2.0" encoding="UTF-8"?>
    <!-- $Id$ -->
    
     <!--  Datasource config for MySQL using 3.0.9 available from:
        http://www.mysql.com/downloads/api-jdbc-stable.html
          -->
      <datasources>
        <local-tx-datasource>
    
          <jndi-name>MySqlDSTest</jndi-name>
          <use-java-context>true</use-java-context>
          <connection-url>jdbc:mysql:loadbalance://ip1,ip2:3306/dbname?</connection-url>
          <url-delimiter>,</url-delimiter>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <connection-property name="readOnly">false</connection-property>
          <autoReconnect>true</autoReconnect>
          <failOverReadOnly>false</failOverReadOnly>
          <user-name>userName</user-name>
          <password>password</password>
          <check-valid-connection-sql>selcect count(*) from TEST_TAB</check-valid-connection-sql>
          <maxReconnects>0</maxReconnects>
          <initialTimeout>15</initialTimeout>
          <idle-timeout-minutes>0</idle-timeout-minutes>
          <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
          <!-- Advanced options for the MySQL Driver can be set with
                  <connection-property name="property">value</connection-property>
            -->
          <min-pool-size>5</min-pool-size>
          <!-- Don't set this any higher than max_connections on your
               MySQL server, usually this should be a 10 or a few 10's
               of connections, not hundreds or thousands -->
          <max-pool-size>20</max-pool-size>
          <!-- Don't allow connections to hang out idle too long,
               never longer than what wait_timeout is set to on the
               server...A few minutes is usually okay here,
               it depends on your application
               and how much spikey load it will see -->
    
          <!-- If you're using Connector/J 3.1.8 or newer, you can use
               our implementation of these to increase the robustness
               "mysql-ds.xml" 64L, 3683C      of the connection pool. -->
          <exception-sorter-class-name>
             com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
          </exception-sorter-class-name>
          <valid-connection-checker-class-name>
             com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
          </valid-connection-checker-class-name>
          <!-- sql to call when connection is created -->
          <new-connection-sql>select 1</new-connection-sql>
          <!-- sql to call on an existing pooled connection when it is obtained from pool -    MySQLValidConnectionChecker is preferred for newer drivers -->
          <check-valid-connection-sql>
            select 1
          </check-valid-connection-sql>
          <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
          <metadata>
            <type-mapping>mySQL</type-mapping>
          </metadata>
        </local-tx-datasource>
      </datasources>
    

    This will work for jboss mapping

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The standard data source configuration in JBoss requires the username and password of the
As i understand it, with JBOSS 7, the data source is configured by creating
I am using JBOSS AS 7.0.2. I want to create a connection to mysql
Can anybody provide the steps for creating DataSource in JBoss server(5.0) with Oracle Database..
In JBoss documentation there is possibility to declare <no-tx-datasource> which states: no-tx-datasource : This
Is there a way to access the JBoss JMX data via JSON? I am
In JBoss one can define a datasource with a *-ds.xml. Is there an equivalent
How to set prefetch size in either oracle connection url or in jboss datasource
I have code which performs query on Jboss server. It has JNDI based datasource
I'm trying to create a jboss-cache for data that is only relevant for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.