JDBC URL with Oracle SID or ServiceName

Posted by Dirk Nachbar on Monday, June 08, 2009
Today I face a small problem with a definition of a JDBC URL which is referencing an Oracle Database.
I just define:
jdbc:oracle:thin:scott/tiger@localhost:1521/PROD.OCZH.CH
where PROD.OCZH.CH is the ServiceName of my Database, but it fails :-(

After a some investigations, the solution is simple, if you want to use the ServiceName of your Database in the JDBC URL you have to place // in front of the servername:
jdbc:oracle:thin:scott/tiger@//localhost:1521/PROD.OCZH.CH
Categories: