Skip to content

Commit

Permalink
Add support for TCPS based connection string to support SSL/TLS conne…
Browse files Browse the repository at this point in the history
…ction.
  • Loading branch information
Vipinofficial11 committed Sep 18, 2024
1 parent 609f908 commit 56336de
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ private OracleConstants() {
public static final String ORACLE_CONNECTION_STRING_SID_FORMAT = "jdbc:oracle:thin:@%s:%s:%s";
public static final String ORACLE_CONNECTION_STRING_SERVICE_NAME_FORMAT = "jdbc:oracle:thin:@//%s:%s/%s";
public static final String ORACLE_CONNECTION_STRING_TNS_FORMAT = "jdbc:oracle:thin:@%s";
public static final String ORACLE_CONNECTION_STRING_TCPS_FORMAT = "jdbc:oracle:thin:@tcps://%s:%s/%s";
public static final String DEFAULT_BATCH_VALUE = "defaultBatchValue";
public static final String DEFAULT_ROW_PREFETCH = "defaultRowPrefetch";
public static final String SERVICE_CONNECTION_TYPE = "service";
public static final String CONNECTION_TYPE = "connectionType";
public static final String ROLE = "role";
public static final String NAME_DATABASE = "database";
public static final String TNS_CONNECTION_TYPE = "TNS";
public static final String TCPS_CONNECTION_TYPE = "TCPS";
public static final String TRANSACTION_ISOLATION_LEVEL = "transactionIsolationLevel";

/**
* Returns the Connection String for the given ConnectionType.
*
* @param connectionType TNS/Service/SID
* @param connectionType TNS/Service/TCPS/SID
* @param host Host name of the oracle server
* @param port Port of the oracle server
* @param database Database to connect to
Expand All @@ -57,7 +59,11 @@ public static String getConnectionString(String connectionType,
}
if (OracleConstants.SERVICE_CONNECTION_TYPE.equalsIgnoreCase(connectionType)) {
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SERVICE_NAME_FORMAT,
host, port, database);
host, port, database);
}
if (OracleConstants.TCPS_CONNECTION_TYPE.equalsIgnoreCase(connectionType)) {
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_TCPS_FORMAT,
host, port, database);
}
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SID_FORMAT,
host, port, database);
Expand Down

0 comments on commit 56336de

Please sign in to comment.