Java JDBC - How to connect to Oracle using Service Name instead of SID

前端 未结 8 964
醉话见心
醉话见心 2020-11-22 15:14

I have a Java application that uses JDBC (via JPA) that was connecting to a development database using hostname, port and Oracle SID, like this:

jdbc:oracle:

相关标签:
8条回答
  • 2020-11-22 15:41

    In case you are using eclipse to connect oracle without SID. There are two drivers to select i.e., Oracle thin driver and other is other driver. Select other drivers and enter service name in database column. Now you can connect directly using service name without SID.

    0 讨论(0)
  • 2020-11-22 15:42

    When using dag instead of thin, the syntax below pointing to service name worked for me. The jdbc:thin solutions above did not work.

    jdbc:dag:oracle://HOSTNAME:1521;ServiceName=SERVICE_NAME
    
    0 讨论(0)
提交回复
热议问题