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?