Skip to content

Commit

Permalink
Enable SSL Connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipinofficial11 committed Oct 8, 2024
1 parent 822e9f3 commit 3c675f4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static class OracleActionConfig extends DBSpecificQueryConfig {

@Override
public String getConnectionString() {
return OracleConstants.getConnectionString(this.connectionType, host, port, database, null);
return OracleConstants.getConnectionString(this.connectionType, host, port, database);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,31 @@ private OracleConstants() {
public static final String TNS_CONNECTION_TYPE = "TNS";
public static final String TRANSACTION_ISOLATION_LEVEL = "transactionIsolationLevel";
public static final String USE_SSL = "useSSL";
public static final String DEFAULT_CONNECTION_PROTOCOL = "tcp";

/**
* Returns the Connection String for the given ConnectionType.
*
* @param connectionType TNS/Service/SID
* @param host Host name of the oracle server
* @param port Port of the oracle server
* @param database Database to connect to
* @return Connection String based on the given ConnectionType
*/
public static String getConnectionString(String connectionType,
@Nullable String host,
@Nullable int port,
String database) {
if (OracleConstants.TNS_CONNECTION_TYPE.equalsIgnoreCase(connectionType)) {
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_TNS_FORMAT, database);
}
if (OracleConstants.SERVICE_CONNECTION_TYPE.equalsIgnoreCase(connectionType)) {
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SERVICE_NAME_FORMAT,
DEFAULT_CONNECTION_PROTOCOL, host, port, database);
}
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SID_FORMAT,
DEFAULT_CONNECTION_PROTOCOL, host, port, database);
}

/**
* Constructs the Oracle connection string based on the provided connection type, host, port, and database.
Expand Down Expand Up @@ -71,9 +96,9 @@ public static String getConnectionString(String connectionType,
}
if (OracleConstants.SERVICE_CONNECTION_TYPE.equalsIgnoreCase(connectionType)) {
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SERVICE_NAME_FORMAT,
connectionProtocol, host, port, database);
connectionProtocol, host, port, database);
}
return String.format(OracleConstants.ORACLE_CONNECTION_STRING_SID_FORMAT,
connectionProtocol, host, port, database);
connectionProtocol, host, port, database);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static class OracleQueryActionConfig extends DBSpecificQueryActionConfig

@Override
public String getConnectionString() {
return OracleConstants.getConnectionString(this.connectionType, host, port, database, null);
return OracleConstants.getConnectionString(this.connectionType, host, port, database);
}

@Override
Expand Down

0 comments on commit 3c675f4

Please sign in to comment.