public abstract class ConnectionFactory extends Object
| Constructor and Description |
|---|
ConnectionFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeStream(RedshiftStream newStream)
Safely close the given stream.
|
static QueryExecutor |
openConnection(HostSpec[] hostSpecs,
String user,
String database,
Properties info,
RedshiftLogger logger)
Establishes and initializes a new connection.
|
abstract QueryExecutor |
openConnectionImpl(HostSpec[] hostSpecs,
String user,
String database,
Properties info,
RedshiftLogger logger)
Implementation of
openConnection(com.amazon.redshift.util.HostSpec[], java.lang.String, java.lang.String, java.util.Properties, com.amazon.redshift.logger.RedshiftLogger) for a particular protocol version. |
public static QueryExecutor openConnection(HostSpec[] hostSpecs, String user, String database, Properties info, RedshiftLogger logger) throws SQLException
Establishes and initializes a new connection.
If the "protocolVersion" property is specified, only that protocol version is tried. Otherwise, all protocols are tried in order, falling back to older protocols as necessary.
Currently, protocol versions 3 (7.4+) is supported.
hostSpecs - at least one host and port to connect to; multiple elements for round-robin
failoveruser - the username to authenticate with; may not be null.database - the database on the server to connect to; may not be null.info - extra properties controlling the connection; notably, "password" if present
supplies the password to authenticate with.logger - the logger to log the entry for debugging.SQLException - if the connection could not be established.public abstract QueryExecutor openConnectionImpl(HostSpec[] hostSpecs, String user, String database, Properties info, RedshiftLogger logger) throws SQLException
openConnection(com.amazon.redshift.util.HostSpec[], java.lang.String, java.lang.String, java.util.Properties, com.amazon.redshift.logger.RedshiftLogger) for a particular protocol version. Implemented by
subclasses of ConnectionFactory.hostSpecs - at least one host and port to connect to; multiple elements for round-robin
failoveruser - the username to authenticate with; may not be null.database - the database on the server to connect to; may not be null.info - extra properties controlling the connection; notably, "password" if present
supplies the password to authenticate with.logger - the logger to log the entry for debugging.null if this protocol version is not
supported by the server.SQLException - if the connection could not be established for a reason other than
protocol version incompatibility.protected void closeStream(RedshiftStream newStream)
newStream - The stream to close.Copyright © 2024 Amazon.com Inc.. All rights reserved.