jdbc连接oracle数据库有两种方式:
- 连接数据库SID
- 连接数据库service_name
当连接SID时,字符串如下:
url="jdbc:oracle:thin:@192.168.56.100:1521:orcl1" password="xxxx" username"scott"
当连接SERVICE_NAME时,字符串如下:
url="jdbc:oracle:thin:@//192.168.56.100:1521/orcl" password="xxxx" username"scott"
也可以用如下方法
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.100)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=Service-name)))