Oracle connection examples

Below are some examples of how a connection to an Oracle database can be configured. Some of them rely on TNS (Transparent Network Substrate).

Using TNS – variant 1

Database = Oracle

DatabaseTns = localhost:1521/ima

DatabaseUser = ima

DatabasePassword = ima

Using TNS – variant 2

Database = Oracle

DatabaseTns = (description=(address=(protocol=TCP)(host=localhost)(port=1521))(connect_data=(service_name=ima)))

DatabaseUser = ima

DatabasePassword = ima

This option above allows advanced functionality like automatically switching between primary and secondary database server with a TNS entry like:

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xx.xxx.x.194)(PORT = 1521))(ADDRESS=(PROTOCOL=TCP)(HOST=xx.xxx.x.196)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME = IMADB)))

Not using TNS

Database = Oracle

DatabaseHost = localhost

DatabasePort = 1521

DatabaseName = xe

DatabaseUser = ima

DatabasePassword = ima