JDBC Connection strings for Oracle (thin driver)

This is a subject that I am often asked about by developers and support teams changing  application configuration details: What is the correct format of JDBC connection strings for the thin driver?

Oracle's JDBC Thin driver uses Java sockets to connect directly to Oracle. It provides its own TCP/IP version of Oracle's SQL*Net protocol. Because it is 100% Java, this driver is platform independent and can also run from a Web Browser (applets).

Old syntax, supporting instance (SID) names only::


New syntax, supporting both SID and SERVICE names:


There are also some drivers that support a URL syntax which allow to put Oracle user id and password in URL.


Finally, you can also give a tnsnames.ora entry-like in the string: