Connection between javaoraclethin and oci for failover of multiple databases

Source: Internet
Author: User
Javaoraclethin and oci Connection Methods for multi-database failover I. thin mode where URL is jdbc: oracle: thin: @ (DESCRIPTION (LOAD_BALANCEon) (ADDRESS (PROTOCOLTCP) (HOST127.0.0.1) (PORT1521) (ADDRESS (PROTOCOLTCP) (HOST10.132.111.14) (PORT1521) (CON

Java oracle thin and oci Connection Methods for multi-database failover I. thin mode where URL is jdbc: oracle: thin: @ (DESCRIPTION = (LOAD_BALANCE = on) (ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521) (ADDRESS = (PROTOCOL = TCP) (HOST = 10.132.111.14) (PORT = 1521) (CON

Java oracle thin and oci Connection Methods for multi-database failover

I. thin Method
The URL is
Jdbc: oracle: thin: @ (DESCRIPTION = (LOAD_BALANCE = on)
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.132.111.14) (PORT = 1521 ))
(CONNECT_DATA = (SERVICE_NAME = bomc )))

LOAD_BALANCE = on indicates that the load is enabled, and java creates a session connection randomly;
LOAD_BANLANCE = off indicates that the load is disabled. java creates Session connections in sequence and only
When the first database fails and cannot be connected, the second database is selected for session connection.


Ii. oci Mode
1. Install the oracle client on the local machine where the specific program is deployed, specify the bin directory of the oracle client in the PATH, and copy
The jdbc driver in the oracle client is included in your project.

2. Configure the TNSNAMES. ORA file as follows:
HA_DB =
(DESCRIPTION_LIST =
(LOAD_BALANCE = on)
(FAILOVER = on)
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = OFF)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = bomc)
(INSTANCE_NAME = bomc)
(FAILOVER_MODE = (TYPE = session) (METHOD = basic) (RETRIES = 4) (DELAY = 1 ))
)
)
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = OFF)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.132.111.14) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = bomc)
(INSTANCE_NAME = bomc)
(FAILOVER_MODE = (TYPE = session) (METHOD = basic) (RETRIES = 4) (DELAY = 1 ))
)
)
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = OFF)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.112.11.161) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = bomc)
(INSTANCE_NAME = bomc)
(FAILOVER_MODE = (TYPE = session) (METHOD = basic) (RETRIES = 4) (DELAY = 1 ))
)
)

)

For more information about the role of configuration parameters, see!

3. java jdbc connection
The URL is written as java: oracle: oci: @ ha_db.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.