Skip to content

Commit

Permalink
Handle null case for SSl mode and Update connector json
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipinofficial11 committed Oct 11, 2024
1 parent 8d62fb9 commit b68ec93
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 28 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);
return OracleConstants.getConnectionString(this.connectionType, host, port, database, null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public String getDatabase() {
}

public Boolean getSSlMode() {
return useSSL;
// return false if useSSL is null, otherwise return its value
return useSSL != null && useSSL;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,6 @@ 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
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);
return OracleConstants.getConnectionString(this.connectionType, host, port, database, null);
}

@Override
Expand Down
20 changes: 20 additions & 0 deletions oracle-plugin/widgets/Oracle-connector.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@
],
"default": "TRANSACTION_SERIALIZABLE"
}
},
{
"widget-type": "hidden",
"label": "TLS Encryption",
"name": "useSSL",
"description": "Enable TLS encryption (true/false)",
"widget-attributes": {
"layout": "inline",
"default": "false",
"options": [
{
"id": "true",
"label": "true"
},
{
"id": "false",
"label": "false"
}
]
}
}
]
},
Expand Down

0 comments on commit b68ec93

Please sign in to comment.