Posted By: Anonymous
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:
XYZ was the Oracle SID. Now I need to connect to a different Oracle database that does not use a SID, but uses an Oracle “Service Name” instead.
I tried this but it doesn’t work:
ABCD is the Service Name of the other database.
What am I doing wrong?
Thin-style Service Name Syntax
Thin-style service names are supported only by the JDBC Thin driver. The syntax is:
So I would try:
Also, per Robert Greathouse’s answer, you can also specify the TNS name in the JDBC URL as below:
jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL=TCP)(HOST=blah.example.com)(PORT=1521)))(CONNECT_DATA=(SID=BLAHSID)(GLOBAL_NAME=BLAHSID.WORLD)(SERVER=DEDICATED)))