Those things about the database connection address

The difference between sid and service_name used by jdbc to connect to the database

Oracle has three methods:

Copy the code
Format 1: Oracle JDBC Thin using a ServiceName:

例如: jdbc:oracle:thin:@//192.168.2.1:1521/name

Format 2: Oracle JDBC Thin using an SID:

For example: jdbc:oracle:thin:@192.168.2.1:1521:sid

Format 3: Oracle JDBC Thin using a TNSName:

For example: jdbc:oracle:thin:@GL

The relationship between service name and sid

service_name: This parameter is introduced by oracle8i. Before 8i, sid was used to indicate an instance of a database, but in Oracle's parallel environment, a database corresponds to multiple instances, so multiple network service names are required, which is cumbersome to set up.
In order to facilitate the settings in the parallel environment, the service_name parameter is introduced, which corresponds to a database, not an instance. The default value of this parameter is Db_name. Db_domain. One database can correspond to multiple service_names to achieve more flexible configuration. This parameter has no direct relationship with sid, that is, the service name does not have to be the same as sid.
Sid is the name of the database instance, each instance is different. Multiple SIDs can share a service name

Guess you like

Origin blog.csdn.net/weixin_38565317/article/details/113739219