首页 > 代码库 > jdbc连接oracle数据库字符串

jdbc连接oracle数据库字符串

jdbc连接oracle数据库有两种方式:

  1. 连接数据库SID
  2. 连接数据库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)))

 

jdbc连接oracle数据库字符串