From 56336de34515dbbf2b96a0ca3874143e7a267035 Mon Sep 17 00:00:00 2001 From: vipinbhatt Date: Wed, 18 Sep 2024 15:23:16 +0530 Subject: [PATCH] Add support for TCPS based connection string to support SSL/TLS connection. --- .../java/io/cdap/plugin/oracle/OracleConstants.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConstants.java b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConstants.java index ec44d7b94..ae462f7b3 100644 --- a/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConstants.java +++ b/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConstants.java @@ -30,6 +30,7 @@ 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"; @@ -37,12 +38,13 @@ private OracleConstants() { 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 @@ -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);