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 committed Jan 9, 2025
1 parent bb00b44 commit 5d62c49
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<>();
// Default port for teradata is 1025
String port = connectionProperties.getOrDefault(PORT, "1025");

// 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);

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

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

0 comments on commit 5d62c49

Please sign in to comment.