Class JDBCUtil
- java.lang.Object
-
- com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil
-
public final class JDBCUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,JdbcMetadataHandler>
createJdbcMetadataHandlerMap(Map<String,String> configOptions, JdbcMetadataHandlerFactory metadataHandlerFactory)
Creates a map of Catalog to respective metadata handler to be used by Multiplexer.static Map<String,JdbcRecordHandler>
createJdbcRecordHandlerMap(Map<String,String> configOptions, JdbcRecordHandlerFactory jdbcRecordHandlerFactory)
Creates a map of Catalog to respective record handler to be used by Multiplexer.static PreparedStatement
getSchemaNameQuery(Connection connection, String databaseName)
static TableName
getSchemaTableName(ResultSet resultSet)
static DatabaseConnectionConfig
getSingleDatabaseConfigFromEnv(String databaseEngine, Map<String,String> configOptions)
Extracts default database configuration for a database.static List<TableName>
getTableMetadata(PreparedStatement preparedStatement, String tableType)
static PreparedStatement
getTableNameQuery(Connection connection, String tableName, String databaseName)
static List<TableName>
getTables(Connection connection, String databaseName)
static TableName
informationSchemaCaseInsensitiveTableMatch(Connection connection, String databaseName, String tableName)
-
-
-
Method Detail
-
getSingleDatabaseConfigFromEnv
public static DatabaseConnectionConfig getSingleDatabaseConfigFromEnv(String databaseEngine, Map<String,String> configOptions)
Extracts default database configuration for a database. Used when a specific database instance handler is used by Lambda function.- Parameters:
databaseEngine
- database type.- Returns:
- database connection confuiguration. See
DatabaseConnectionConfig
.
-
createJdbcMetadataHandlerMap
public static Map<String,JdbcMetadataHandler> createJdbcMetadataHandlerMap(Map<String,String> configOptions, JdbcMetadataHandlerFactory metadataHandlerFactory)
Creates a map of Catalog to respective metadata handler to be used by Multiplexer.- Parameters:
configOptions
- system configOptions.metadataHandlerFactory
- factory for creating the appropriate metadata handler for the database type- Returns:
- Map of String ->
JdbcMetadataHandler
-
createJdbcRecordHandlerMap
public static Map<String,JdbcRecordHandler> createJdbcRecordHandlerMap(Map<String,String> configOptions, JdbcRecordHandlerFactory jdbcRecordHandlerFactory)
Creates a map of Catalog to respective record handler to be used by Multiplexer.- Parameters:
configOptions
- system configOptions.jdbcRecordHandlerFactory
-- Returns:
- Map of String ->
JdbcRecordHandler
-
informationSchemaCaseInsensitiveTableMatch
public static TableName informationSchemaCaseInsensitiveTableMatch(Connection connection, String databaseName, String tableName) throws Exception
- Throws:
Exception
-
getTableNameQuery
public static PreparedStatement getTableNameQuery(Connection connection, String tableName, String databaseName) throws SQLException
- Throws:
SQLException
-
getSchemaNameQuery
public static PreparedStatement getSchemaNameQuery(Connection connection, String databaseName) throws SQLException
- Throws:
SQLException
-
getTables
public static List<TableName> getTables(Connection connection, String databaseName) throws SQLException
- Throws:
SQLException
-
getTableMetadata
public static List<TableName> getTableMetadata(PreparedStatement preparedStatement, String tableType)
-
getSchemaTableName
public static TableName getSchemaTableName(ResultSet resultSet) throws SQLException
- Throws:
SQLException
-
-