JAVA 在application.properties的配置oracle

集群配置

spring.datasource.jdbc-url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.x)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.x)(PORT=1521)))(FAILOVER=yes)(LOAD_BALANCE=yes)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxxxx)))

spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver

spring.datasource.username=

spring.datasource.password=


JDBC Thin Driver 的formats 有三种格式:

格式一:  Oracle JDBC Thin using a ServiceName: 

jdbc:oracle:thin:@//:/ 

Example: jdbc:oracle:thin:@//192.168.2.1:1521/XE

注意这里的格式,@后面有//, 这是与使用SID的主要区别。

这种格式是Oracle 推荐的格式,因为对于集群来说,每个节点的SID 是不一样的,但是SERVICE_NAME 确可以包含所有节点。


格式二: Oracle JDBC Thin using an SID: 

jdbc:oracle:thin:@:: 

Example: jdbc:oracle:thin:192.168.2.1:1521:X01A 

Note: Support for SID is being phased out. Oracle recommends that users switch over to usingservice names.


格式三:Oracle JDBC Thin using a TNSName: 

jdbc:oracle:thin:@ 

Example: jdbc:oracle:thin:@GL 

Note: 

Support for TNSNames was added in the driver release 10.2.0.1

你可能感兴趣的:(JAVA 在application.properties的配置oracle)