[Oracle] JDBC link method

#service_name

格式:jdbc:oracle:thin:@//<host>:<port>/<service_name> 

例如:datasource1.url=jdbc\:oracle\:thin\:@//172.16.20.248\:1521/trade

 

#sid

格式:jdbc:oracle:thin:@<host>:<port>:<SID> 

例如:datasource1.url=jdbc\:oracle\:thin\:@172.16.23.235\:1521\:tradenew

 

Multiple nodes:

datasource1.url=jdbc:oracle:thin:@ 
(description=    
  (ADDRESS_LIST = 
    (address=(protocol=tcp)(host=192.168.1.44)(port=1521)) 
    (address=(protocol=tcp)(host=192.168 .1.45)(port=1521)) 
    (address=(protocol=tcp)(host=192.168.1.46)(port=1521)) 
    (load_balance=yes)//Indicates whether to load balance 
  ) 
  (connect_data = 
  //(server = dedicated)//This parameter indicates the dedicated server mode 
    (service_name=ORACMS)//The service name to operate the database 
    (failover_mode =//The way to process after the connection fails 
      (type=session)//TYPE =SESSION indicates that when a connection is good If the instance of the session fails, the system will automatically switch the session to another available instance, and the foreground application does not need to initiate a connection again, but the SQL that is being executed by the session needs to be re-executed. 
      (method=basic)//Indicates that the initial connection is connected to a node 
      ( retries=5)//The number of times to retry the connection after the connection fails 
      (delay=15)//The delay time of the retry after the connection fails (in seconds) 
    ) 
  ) 

-- key points 
1. The value of the load_balance parameter is yes, which means the connection is in load balancing mode, and the value is no, which means that the non-load balancing mode is used. 
2. The value of this parameter of method is basic, which means that there is only one connection node for the initial connection, and the value of preconnect means that Initially connect all rac contacts 
3. The server parameter value dedicated indicates dedicated server mode, which is not practical and can be removed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326266268&siteId=291194637