Thursday, February 09, 2012

Oracle and Eclipse: SID vs Service Name

Saw this in Eclipse when trying to connect to an Oracle database using Data Source Explorer.

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

Problem seems to be that when setting up my Oracle Thin driver properties, the SID really has to be a SID, when all I have is a Service Name. It means that the resulting DB URL is: jdbc:oracle:thin:@host:port:sid when it should be: jdbc:oracle:thin:@host:port/service-name.

The answer is to use a different option in Eclipse when setting up the driver. Window > Preferences > Data Management > Connectivity > Driver Definitions > choose "Other Driver" for Oracle instead of Oracle Thin Driver. This gives you the option of directly setting the Connection URL.