Skip to content

Commit

Permalink
Add port number as a DBS_PORT parameter in Teradata JDBC Connection S…
Browse files Browse the repository at this point in the history
…tring
  • Loading branch information
Jithendar12 authored and AbdulR3hman committed Jan 10, 2025
1 parent 09e8689 commit ebf8eb4
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,31 @@

import com.amazonaws.athena.connectors.jdbc.JdbcEnvironmentProperties;

import java.util.HashMap;
import java.util.Map;

import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.DATABASE;
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.DEFAULT;
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.HOST;
import static com.amazonaws.athena.connector.lambda.connection.EnvironmentConstants.PORT;

public class TeradataEnvironmentProperties extends JdbcEnvironmentProperties
{
@Override
public Map<String, String> connectionPropertiesToEnvironment(Map<String, String> connectionProperties)
{
HashMap<String, String> environment = new HashMap<>();

Check warning on line 37 in athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java

View check run for this annotation

Codecov / codecov/patch

athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java#L37

Added line #L37 was not covered by tests
// Default port for teradata is 1025
String port = connectionProperties.getOrDefault(PORT, "1025");

Check warning on line 39 in athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java

View check run for this annotation

Codecov / codecov/patch

athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java#L39

Added line #L39 was not covered by tests

// Construct the JDBC connection string and include the port as a DBS_PORT parameter
String connectionString = getConnectionStringPrefix(connectionProperties) + connectionProperties.get(HOST)
+ getDatabase(connectionProperties) + ",DBS_PORT=" + port + getJdbcParameters(connectionProperties);

Check warning on line 43 in athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java

View check run for this annotation

Codecov / codecov/patch

athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java#L42-L43

Added lines #L42 - L43 were not covered by tests

environment.put(DEFAULT, connectionString);
return environment;

Check warning on line 46 in athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java

View check run for this annotation

Codecov / codecov/patch

athena-teradata/src/main/java/com/amazonaws/athena/connectors/teradata/TeradataEnvironmentProperties.java#L45-L46

Added lines #L45 - L46 were not covered by tests
}

@Override
protected String getConnectionStringPrefix(Map<String, String> connectionProperties)
{
Expand Down

0 comments on commit ebf8eb4

Please sign in to comment.