Quantcast
Channel: Oracle – Oracle DBA Resources
Viewing all articles
Browse latest Browse all 39

JDBC Connection strings for Oracle (thin driver)

$
0
0

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::

jdbc:oracle:thin:@HOST:PORT:SID

New syntax, supporting both SID and SERVICE names:

jdbc:oracle:thin:@//HOST:PORT/SERVICE

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

jdbc:oracle:thin:[USER/PASSWORD]@HOST:PORT:SID
jdbc:oracle:thin:[USER/PASSWORD]@//HOST:PORT/SERVICE

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

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=<host>)(PORT=<port>))(CONNECT_DATA=(SERVICE_NAME=<service>)))

Viewing all articles
Browse latest Browse all 39

Trending Articles