首页 > 代码库 > 确定Oracle URL

确定Oracle URL

1、查看/u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

cat /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.


PRODB =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = scan-rhel65.discuz.com)(PORT = 1521))

    (CONNECT_DATA =http://www.mamicode.com/

      (SERVER = DEDICATED)

      (SERVICE_NAME = prodb.discuz.com)

    )

  )


2、ORACLE URL 格式

普通SID方式

jdbc:oracle:thin:username/password@x.x.x.1:1521:SID

普通ServerName方式

jdbc:Oracle:thin:username/password@//x.x.x.1:1522/ABCD

RAC方式

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.2)(PORT=1521)))(LOAD_BALANCE=yes)(CONNECT_DATA=http://www.mamicode.com/(SERVER=DEDICATED)(SERVICE_NAME=xxrac)))


确定Oracle URL