Configure JDBC connection to Oracle RAC Database

Source: Internet
Author: User

 

The RAC configuration is as follows:

 

Node1: IP address 192.168.60.132, Instance name: Rac1, Host Name: Rac1

 

Node2: IP address 192.168.60.144, Instance name: rac2, Host Name: rac2

 

The RAC service name is oratest.

My application server is Apache + Tomcat

 

 

 

 

The configuration process is as follows:

 

1. After searching, we found that there are many connection RAC methods and copied the following jdbcurl:

 

JDBC: oracle: thin: @ (description = (address_list = (address = (host = 192.168.60.132) (Protocol = TCP) (Port = 1521) (address = (host = 192.168.60.144) (Protocol = TCP) (Port = 1521) (load_balance = yes) (Failover = yes) (CONNECT_DATA = (SERVICE_NAME = oratest )))

 

However, Tomcat reports the following error:

IoException: NL exception was generated;

 

2. Google and Baidu on the Internet. Although the n method is found, the error is always prompted;

 

3. In desperation, open the database tnsname. ora and find that the configuration is as follows:

Oratest =

(Description =

(Address_list =

(Address = (Protocol = TCP) (host = Rac1) (Port = 1521 ))

(Address = (Protocol = TCP) (host = rac2) (Port = 1521 ))

(Load_balance = yes)

)

(CONNECT_DATA =

(Server = dedicated)

(SERVICE_NAME = oratest)

)

)

Modify jdbcur:

JDBC: oracle: thin: @ (description = (address_list = (address = (host = Rac1) (Protocol = TCP) (Port = 1521) (address = (host = rac2) (Protocol = TCP) (Port = 1521) (load_balance = yes) (Failover = yes) (CONNECT_DATA = (SERVICE_NAME = oratest )))

 

The test result is successful;

Initially, the Database Service adopts the host name, while the IP address in jdbcurl will cause the NL exception;

 

Suggestion: if there is a problem connecting RAC, it is best to use the connection string in tnsnames. ora to connect;

 

Do you have such a problem?

Related Article

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.