public class RedshiftConnectionImpl extends Object implements BaseConnection
| Modifier and Type | Class and Description |
|---|---|
class |
RedshiftConnectionImpl.AbortCommand |
| Modifier and Type | Field and Description |
|---|---|
protected int |
defaultFetchSize
Default fetch size for statement.
|
protected boolean |
enableGeneratedName |
protected boolean |
forcebinary |
static boolean |
IS_64_BIT_JVM |
protected DatabaseMetaData |
metadata |
static List<String> |
NON_IAM_PLUGINS_LIST |
static String |
NON_VALIDATING_SSL_FACTORY |
protected int |
prepareThreshold |
protected Properties |
props |
protected Map<String,Class<?>> |
typemap
The current type mappings.
|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE| Constructor and Description |
|---|
RedshiftConnectionImpl(HostSpec[] hostSpecs,
String user,
String database,
RedshiftProperties info,
String url,
RedshiftLogger logger) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
abort() |
void |
abort(Executor executor) |
void |
addDataType(String type,
Class<? extends RedshiftObject> klass)
This allows client code to add a handler for one of com.amazon.redshift's more unique data types.
|
void |
addDataType(String type,
String name)
This allows client code to add a handler for one of com.amazon.redshift's more unique data types.
|
void |
addTimerTask(TimerTask timerTask,
long milliSeconds)
Schedule a TimerTask for later execution.
|
void |
addWarning(SQLWarning warn)
This adds a warning to the warning chain.
|
boolean |
binaryTransferSend(int oid)
Returns true if value for the given oid should be sent using binary transfer.
|
void |
cancelQuery()
Cancel the current query executing on this connection.
|
protected void |
checkClosed() |
void |
clearWarnings() |
void |
close()
Note: even though
Statement is automatically closed when it is garbage
collected, it is better to close it explicitly to lower resource consumption. |
void |
commit() |
Array |
createArrayOf(String typeName,
Object elements)
Creates an
Array wrapping elements. |
Array |
createArrayOf(String typeName,
Object[] elements) |
Blob |
createBlob() |
Clob |
createClob() |
NClob |
createNClob() |
CachedQuery |
createQuery(String sql,
boolean escapeProcessing,
boolean isParameterized,
String... columnNames) |
<T> T |
createQueryObject(Class<T> ifc) |
SQLXML |
createSQLXML() |
Statement |
createStatement() |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency) |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
Struct |
createStruct(String typeName,
Object[] attributes) |
protected TypeInfo |
createTypeInfo(BaseConnection conn,
int unknownLength) |
byte[] |
encodeString(String str)
Encode a string using the database's client_encoding (usually UTF8, but can vary on older
server versions).
|
String |
escapeIdentifier(String identifier)
Return the given string suitably quoted to be used as an identifier in an SQL statement string.
|
String |
escapeLiteral(String literal)
Return the given string suitably quoted to be used as a string literal in an SQL statement
string.
|
String |
escapeOnlyQuotesString(String str)
Escapes only quotes in string for catalog name.
|
String |
escapeString(String str)
Escapes a string for use as string-literal within an SQL command.
|
ResultSet |
execSQLQuery(String s)
Execute a SQL query that returns a single resultset.
|
ResultSet |
execSQLQuery(String s,
int resultSetType,
int resultSetConcurrency) |
void |
execSQLUpdate(String s)
Execute a SQL query that does not return results.
|
protected void |
finalize()
Overrides finalize().
|
boolean |
getAutoCommit() |
AutoSave |
getAutosave()
Connection configuration regarding automatic per-query savepoints.
|
int |
getBackendPID()
Return the process ID (PID) of the backend server process handling this connection.
|
Long |
getBytesReadFromStream() |
String |
getCatalog() |
Properties |
getClientInfo() |
String |
getClientInfo(String name) |
Properties |
getConnectionProperties() |
CopyManager |
getCopyAPI()
This returns the COPY API for the current connection.
|
String |
getCursorName()
getCursorName gets the cursor name.
|
String |
getDBVersionNumber()
Get server version number.
|
int |
getDefaultFetchSize()
Get the default fetch size for statements created from this connection.
|
Encoding |
getEncoding() |
Fastpath |
getFastpathAPI()
This returns the Fastpath API for the current connection.
|
LruCache<FieldMetadata.Key,FieldMetadata> |
getFieldMetadataCache()
Return metadata cache for given connection.
|
boolean |
getForceBinary() |
boolean |
getGeneratedName() |
boolean |
getHideUnprivilegedObjects() |
int |
getHoldability() |
protected String |
getIsolationLevelName(int level) |
LargeObjectManager |
getLargeObjectAPI()
This returns the LargeObject API for the current connection.
|
RedshiftLogger |
getLogger() |
DatabaseMetaData |
getMetaData() |
int |
getNetworkTimeout() |
RedshiftNotification[] |
getNotifications()
This method returns any notifications that have been received since the last call to this
method.
|
RedshiftNotification[] |
getNotifications(int timeoutMillis)
This method returns any notifications that have been received since the last call to this
method.
|
Object |
getObject(String type,
String value,
byte[] byteValue)
Construct and return an appropriate object for the given type and value.
|
static String |
getOptionalConnSetting(String key,
Properties info) |
static String |
getOptionalSetting(String key,
Properties info)
Get the optional setting.
|
Integer |
getOverrideSchemaPatternType() |
String |
getParameterStatus(String parameterName)
Shorthand for getParameterStatuses().get(...) .
|
Map<String,String> |
getParameterStatuses()
Returns the current values of all parameters reported by the server.
|
PreferQueryMode |
getPreferQueryMode()
Returns the query mode for this connection.
|
int |
getPrepareThreshold()
Get the default server-side prepare reuse threshold for statements created from this
connection.
|
int |
getProtocolVersion() |
QueryExecutor |
getQueryExecutor()
Get the QueryExecutor implementation for this connection.
|
RedshiftReplicationConnection |
getReplicationAPI() |
ReplicationProtocol |
getReplicationProtocol()
Internal protocol for work with physical and logical replication.
|
static String |
getRequiredConnSetting(String key,
Properties info) |
static String |
getRequiredSetting(String key,
Properties info)
Get the required setting, and throw an exception if it isn't present.
|
int |
getReWriteBatchedInsertsSize() |
String |
getSchema() |
int |
getServerMajorVersion()
Get server major version.
|
int |
getServerMinorVersion()
Get server minor version.
|
boolean |
getStandardConformingStrings()
Returns whether the server treats string-literals according to the SQL standard or if it uses
traditional Redshift escaping rules.
|
boolean |
getStringVarcharFlag() |
TimestampUtils |
getTimestampUtils() |
int |
getTransactionIsolation() |
TransactionState |
getTransactionState()
Get the current transaction state of this connection.
|
TypeInfo |
getTypeInfo() |
Map<String,Class<?>> |
getTypeMap() |
String |
getURL()
We are required to bring back certain information by the DatabaseMetaData class.
|
String |
getUserName()
Method getUserName() brings back the User Name (again, we saved it).
|
SQLWarning |
getWarnings() |
boolean |
haveMinimumServerVersion(int ver)
Check if we have at least a particular server version.
|
boolean |
haveMinimumServerVersion(Version ver)
Check if we have at least a particular server version.
|
boolean |
hintReadOnly()
Indicates if statements to backend should be hinted as read only.
|
boolean |
isClosed() |
boolean |
isColumnSanitiserDisabled()
Return whether to disable column name sanitation.
|
boolean |
isDatabaseMetadataCurrentDbOnly() |
boolean |
isReadOnly() |
boolean |
isValid(int timeout) |
boolean |
isWrapperFor(Class<?> iface) |
protected Array |
makeArray(int oid,
String fieldString) |
protected Blob |
makeBlob(long oid) |
protected Clob |
makeClob(long oid) |
protected SQLXML |
makeSQLXML() |
String |
nativeSQL(String sql) |
CallableStatement |
prepareCall(String sql) |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency) |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
PreparedStatement |
prepareStatement(String sql) |
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys) |
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes) |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency) |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
PreparedStatement |
prepareStatement(String sql,
String[] columnNames) |
void |
purgeTimerTasks()
Invoke purge() on the underlying shared Timer so that internal resources will be released.
|
void |
releaseSavepoint(Savepoint savepoint) |
void |
rollback() |
void |
rollback(Savepoint savepoint) |
void |
setAutoCommit(boolean autoCommit) |
void |
setAutosave(AutoSave autoSave)
Configures if connection should use automatic savepoints.
|
void |
setCatalog(String catalog) |
void |
setClientInfo(Properties properties) |
void |
setClientInfo(String name,
String value) |
void |
setCursorName(String cursor)
In SQL, a result table can be retrieved through a cursor that is named.
|
void |
setDatabaseMetadataCurrentDbOnly(boolean databaseMetadataCurrentDbOnly) |
void |
setDefaultFetchSize(int fetchSize)
Set the default fetch size for statements created from this connection.
|
void |
setDisableColumnSanitiser(boolean disableColumnSanitiser) |
void |
setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate)
By default, the connection resets statement cache in case deallocate all/discard all
message is observed.
|
void |
setForceBinary(boolean newValue) |
void |
setGeneratedName(boolean enable) |
void |
setHoldability(int holdability) |
void |
setNetworkTimeout(Executor executor,
int milliseconds) |
void |
setPrepareThreshold(int newThreshold)
Set the default statement reuse threshold before enabling server-side prepare.
|
void |
setReadOnly(boolean readOnly) |
Savepoint |
setSavepoint() |
Savepoint |
setSavepoint(String name) |
void |
setSchema(String schema) |
void |
setTransactionIsolation(int level) |
void |
setTypeMap(Map<String,Class<?>> map) |
void |
setTypeMapImpl(Map<String,Class<?>> map) |
<T> T |
unwrap(Class<T> iface) |
protected Properties props
protected int prepareThreshold
protected boolean enableGeneratedName
protected int defaultFetchSize
RedshiftProperty.DEFAULT_ROW_FETCH_SIZEprotected boolean forcebinary
public static String NON_VALIDATING_SSL_FACTORY
public static final boolean IS_64_BIT_JVM
protected DatabaseMetaData metadata
public RedshiftConnectionImpl(HostSpec[] hostSpecs, String user, String database, RedshiftProperties info, String url, RedshiftLogger logger) throws SQLException
SQLExceptionpublic CachedQuery createQuery(String sql, boolean escapeProcessing, boolean isParameterized, String... columnNames) throws SQLException
createQuery in interface BaseConnectionSQLExceptionpublic void setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate)
BaseConnectionsetFlushCacheOnDeallocate in interface BaseConnectionflushCacheOnDeallocate - true if statement cache should be reset when "deallocate/discard" message observedpublic TimestampUtils getTimestampUtils()
getTimestampUtils in interface BaseConnectionpublic Statement createStatement() throws SQLException
createStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic CallableStatement prepareCall(String sql) throws SQLException
prepareCall in interface ConnectionSQLExceptionpublic Map<String,Class<?>> getTypeMap() throws SQLException
getTypeMap in interface ConnectionSQLExceptionpublic QueryExecutor getQueryExecutor()
BaseConnectiongetQueryExecutor in interface BaseConnectionpublic ReplicationProtocol getReplicationProtocol()
BaseConnectiongetReplicationProtocol in interface BaseConnectionpublic void addWarning(SQLWarning warn)
warn - warning to addpublic ResultSet execSQLQuery(String s) throws SQLException
BaseConnectionexecSQLQuery in interface BaseConnections - the query to executeSQLException - if something goes wrong.public Long getBytesReadFromStream()
getBytesReadFromStream in interface RedshiftConnectionpublic ResultSet execSQLQuery(String s, int resultSetType, int resultSetConcurrency) throws SQLException
execSQLQuery in interface BaseConnectionSQLExceptionpublic void execSQLUpdate(String s) throws SQLException
BaseConnectionexecSQLUpdate in interface BaseConnections - the query to executeSQLException - if something goes wrong.public void setCursorName(String cursor) throws SQLException
In SQL, a result table can be retrieved through a cursor that is named. The current row of a result can be updated or deleted using a positioned update/delete statement that references the cursor name.
We do not support positioned update/delete, so this is a no-op.
cursor - the cursor nameSQLException - if a database access error occurspublic String getCursorName() throws SQLException
SQLException - if a database access error occurspublic String getURL() throws SQLException
We are required to bring back certain information by the DatabaseMetaData class. These functions do that.
Method getURL() brings back the URL (good job we saved it)
SQLException - just in case...public String getUserName() throws SQLException
SQLException - just in case...public Fastpath getFastpathAPI() throws SQLException
RedshiftConnectiongetFastpathAPI in interface RedshiftConnectionSQLException - if something wrong happenspublic LargeObjectManager getLargeObjectAPI() throws SQLException
RedshiftConnectiongetLargeObjectAPI in interface RedshiftConnectionSQLException - if something wrong happenspublic Object getObject(String type, String value, byte[] byteValue) throws SQLException
BaseConnectionConstruct and return an appropriate object for the given type and value. This only considers
the types registered via RedshiftConnection.addDataType(String, Class) and
RedshiftConnection.addDataType(String, String).
If no class is registered as handling the given type, then a generic
RedshiftObject instance is returned.
getObject in interface BaseConnectiontype - the backend typenamevalue - the type-specific string representation of the valuebyteValue - the type-specific binary representation of the valueSQLException - if something goes wrongprotected TypeInfo createTypeInfo(BaseConnection conn, int unknownLength)
public TypeInfo getTypeInfo()
getTypeInfo in interface BaseConnectionpublic Properties getConnectionProperties()
public void addDataType(String type, String name)
RedshiftConnectionaddDataType(type, Class.forName(name)).addDataType in interface RedshiftConnectiontype - JDBC type namename - class namepublic void addDataType(String type, Class<? extends RedshiftObject> klass) throws SQLException
RedshiftConnectionThis allows client code to add a handler for one of com.amazon.redshift's more unique data types.
NOTE: This is not part of JDBC, but an extension.
The best way to use this is as follows:
...
((com.amazon.redshift.RedshiftConnection)myconn).addDataType("mytype", my.class.name.class);
...
where myconn is an open Connection to com.amazon.redshift.
The handling class must extend com.amazon.redshift.util.RedshiftObject
addDataType in interface RedshiftConnectiontype - the Redshift type to registerklass - the class implementing the Java representation of the type; this class must
implement RedshiftObject).SQLException - if klass does not implement
RedshiftObject).RedshiftObjectpublic void close()
throws SQLException
Statement is automatically closed when it is garbage
collected, it is better to close it explicitly to lower resource consumption.
close in interface AutoCloseableclose in interface ConnectionSQLExceptionpublic String nativeSQL(String sql) throws SQLException
nativeSQL in interface ConnectionSQLExceptionpublic SQLWarning getWarnings() throws SQLException
getWarnings in interface ConnectionSQLExceptionpublic void clearWarnings()
throws SQLException
clearWarnings in interface ConnectionSQLExceptionpublic void setDatabaseMetadataCurrentDbOnly(boolean databaseMetadataCurrentDbOnly)
throws SQLException
SQLExceptionpublic boolean isDatabaseMetadataCurrentDbOnly()
public void setReadOnly(boolean readOnly)
throws SQLException
setReadOnly in interface ConnectionSQLExceptionpublic boolean isReadOnly()
throws SQLException
isReadOnly in interface ConnectionSQLExceptionpublic boolean hintReadOnly()
BaseConnectionhintReadOnly in interface BaseConnectionRedshiftProperty.READ_ONLY_MODEpublic void setAutoCommit(boolean autoCommit)
throws SQLException
setAutoCommit in interface ConnectionSQLExceptionpublic boolean getAutoCommit()
throws SQLException
getAutoCommit in interface ConnectionSQLExceptionpublic void commit()
throws SQLException
commit in interface ConnectionSQLExceptionprotected void checkClosed()
throws SQLException
SQLExceptionpublic void rollback()
throws SQLException
rollback in interface ConnectionSQLExceptionpublic TransactionState getTransactionState()
BaseConnectiongetTransactionState in interface BaseConnectionpublic int getTransactionIsolation()
throws SQLException
getTransactionIsolation in interface ConnectionSQLExceptionpublic void setTransactionIsolation(int level)
throws SQLException
setTransactionIsolation in interface ConnectionSQLExceptionprotected String getIsolationLevelName(int level)
public void setCatalog(String catalog) throws SQLException
setCatalog in interface ConnectionSQLExceptionpublic String getCatalog() throws SQLException
getCatalog in interface ConnectionSQLExceptionpublic boolean getHideUnprivilegedObjects()
protected void finalize()
throws Throwable
Overrides finalize(). If called, it closes the connection.
This was done at the request of Rachel Greenham who hit a problem where multiple clients didn't close the connection, and once a fortnight enough clients were open to kill the postgres server.
public String getDBVersionNumber()
public int getServerMajorVersion()
public int getServerMinorVersion()
public boolean haveMinimumServerVersion(int ver)
BaseConnectionCheck if we have at least a particular server version.
The input version is of the form xxyyzz, matching a Redshift version like xx.yy.zz. So 08.00.02 is 080002.
haveMinimumServerVersion in interface BaseConnectionver - the server version to check, of the form xxyyzz eg 90401public boolean haveMinimumServerVersion(Version ver)
BaseConnectionCheck if we have at least a particular server version.
The input version is of the form xxyyzz, matching a Redshift version like xx.yy.zz. So 8.0.2 is 80002.
haveMinimumServerVersion in interface BaseConnectionver - the server version to checkpublic Encoding getEncoding()
getEncoding in interface BaseConnectionpublic byte[] encodeString(String str) throws SQLException
BaseConnectionencodeString in interface BaseConnectionstr - the string to encodeSQLException - if something goes wrong.public String escapeString(String str) throws SQLException
BaseConnectionBaseConnection.getStandardConformingStrings().escapeString in interface BaseConnectionstr - a string valueSQLException - if the string contains a \0 characterpublic String escapeOnlyQuotesString(String str) throws SQLException
BaseConnectionBaseConnection.getStandardConformingStrings().escapeOnlyQuotesString in interface BaseConnectionstr - a string valueSQLException - if the string contains a \0 characterpublic boolean getStandardConformingStrings()
BaseConnectionstandard_conforming_strings server variable.getStandardConformingStrings in interface BaseConnectionQueryExecutor.getStandardConformingStrings()public boolean isClosed()
throws SQLException
isClosed in interface ConnectionSQLExceptionpublic void cancelQuery()
throws SQLException
BaseConnectioncancelQuery in interface BaseConnectioncancelQuery in interface RedshiftConnectionSQLException - if something goes wrong.public RedshiftNotification[] getNotifications() throws SQLException
RedshiftConnectiongetNotifications in interface RedshiftConnectionSQLException - if something wrong happenspublic RedshiftNotification[] getNotifications(int timeoutMillis) throws SQLException
RedshiftConnectiongetNotifications in interface RedshiftConnectiontimeoutMillis - when 0, blocks forever. when > 0, blocks up to the specified number of millies
or until at least one notification has been received. If more than one notification is
about to be received, these will be returned in one batch.SQLException - if something wrong happenspublic int getPrepareThreshold()
RedshiftConnectiongetPrepareThreshold in interface RedshiftConnectionpublic void setDefaultFetchSize(int fetchSize)
throws SQLException
RedshiftConnectionsetDefaultFetchSize in interface RedshiftConnectionfetchSize - new default fetch sizeSQLException - if specified negative fetchSize parameterStatement.setFetchSize(int)public int getDefaultFetchSize()
RedshiftConnectiongetDefaultFetchSize in interface RedshiftConnectionRedshiftProperty.DEFAULT_ROW_FETCH_SIZE,
Statement.getFetchSize()public int getReWriteBatchedInsertsSize()
public Integer getOverrideSchemaPatternType()
public void setPrepareThreshold(int newThreshold)
RedshiftConnectionRedshiftStatement.setPrepareThreshold(int) for details.setPrepareThreshold in interface RedshiftConnectionnewThreshold - the new thresholdpublic void setGeneratedName(boolean enable)
public boolean getGeneratedName()
public boolean getForceBinary()
public void setForceBinary(boolean newValue)
public void setTypeMapImpl(Map<String,Class<?>> map) throws SQLException
SQLExceptionpublic RedshiftLogger getLogger()
getLogger in interface BaseConnectionpublic int getProtocolVersion()
public boolean getStringVarcharFlag()
getStringVarcharFlag in interface BaseConnectionpublic CopyManager getCopyAPI() throws SQLException
RedshiftConnectiongetCopyAPI in interface RedshiftConnectionSQLException - if something wrong happenspublic boolean binaryTransferSend(int oid)
BaseConnectionbinaryTransferSend in interface BaseConnectionoid - The oid to check.public int getBackendPID()
RedshiftConnectiongetBackendPID in interface RedshiftConnectionpublic boolean isColumnSanitiserDisabled()
BaseConnectionisColumnSanitiserDisabled in interface BaseConnectionpublic void setDisableColumnSanitiser(boolean disableColumnSanitiser)
public PreferQueryMode getPreferQueryMode()
RedshiftConnectionReturns the query mode for this connection.
When running in simple query mode, certain features are not available: callable statements, partial result set fetch, bytea type, etc.
The list of supported features is subject to change.
getPreferQueryMode in interface RedshiftConnectionPreferQueryModepublic AutoSave getAutosave()
RedshiftConnectiongetAutosave in interface RedshiftConnectionRedshiftProperty.AUTOSAVEpublic void setAutosave(AutoSave autoSave)
RedshiftConnectionsetAutosave in interface RedshiftConnectionautoSave - connection configuration regarding automatic per-query savepointsRedshiftProperty.AUTOSAVEprotected void abort()
public void addTimerTask(TimerTask timerTask, long milliSeconds)
BaseConnectionaddTimerTask in interface BaseConnectiontimerTask - timer task to schedulemilliSeconds - delay in millisecondspublic void purgeTimerTasks()
BaseConnectionpurgeTimerTasks in interface BaseConnectionpublic String escapeIdentifier(String identifier) throws SQLException
RedshiftConnectionescapeIdentifier in interface RedshiftConnectionidentifier - input identifierSQLException - if something goes wrongpublic String escapeLiteral(String literal) throws SQLException
RedshiftConnectionescapeLiteral in interface RedshiftConnectionliteral - input literalSQLException - if something goes wrongpublic LruCache<FieldMetadata.Key,FieldMetadata> getFieldMetadataCache()
BaseConnectiongetFieldMetadataCache in interface BaseConnectionpublic RedshiftReplicationConnection getReplicationAPI()
getReplicationAPI in interface RedshiftConnectionpublic Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
createStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareCall in interface ConnectionSQLExceptionpublic DatabaseMetaData getMetaData() throws SQLException
getMetaData in interface ConnectionSQLExceptionpublic void setTypeMap(Map<String,Class<?>> map) throws SQLException
setTypeMap in interface ConnectionSQLExceptionprotected Array makeArray(int oid, String fieldString) throws SQLException
SQLExceptionprotected Blob makeBlob(long oid) throws SQLException
SQLExceptionprotected Clob makeClob(long oid) throws SQLException
SQLExceptionprotected SQLXML makeSQLXML() throws SQLException
SQLExceptionpublic Clob createClob() throws SQLException
createClob in interface ConnectionSQLExceptionpublic Blob createBlob() throws SQLException
createBlob in interface ConnectionSQLExceptionpublic NClob createNClob() throws SQLException
createNClob in interface ConnectionSQLExceptionpublic SQLXML createSQLXML() throws SQLException
createSQLXML in interface ConnectionSQLExceptionpublic Struct createStruct(String typeName, Object[] attributes) throws SQLException
createStruct in interface ConnectionSQLExceptionpublic Array createArrayOf(String typeName, Object elements) throws SQLException
RedshiftConnectionArray wrapping elements. This is similar to
Connection.createArrayOf(String, Object[]), but also
provides support for primitive arrays.createArrayOf in interface RedshiftConnectiontypeName - The SQL name of the type to map the elements to.
Must not be null.elements - The array of objects to map. A null value will result in
an Array representing null.Array wrapping elements.SQLException - If for some reason the array cannot be created.Connection.createArrayOf(String, Object[])public Array createArrayOf(String typeName, Object[] elements) throws SQLException
createArrayOf in interface ConnectionSQLExceptionpublic boolean isValid(int timeout)
throws SQLException
isValid in interface ConnectionSQLExceptionpublic void setClientInfo(String name, String value) throws SQLClientInfoException
setClientInfo in interface ConnectionSQLClientInfoExceptionpublic void setClientInfo(Properties properties) throws SQLClientInfoException
setClientInfo in interface ConnectionSQLClientInfoExceptionpublic String getClientInfo(String name) throws SQLException
getClientInfo in interface ConnectionSQLExceptionpublic Properties getClientInfo() throws SQLException
getClientInfo in interface ConnectionSQLExceptionpublic <T> T createQueryObject(Class<T> ifc) throws SQLException
SQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic String getSchema() throws SQLException
getSchema in interface ConnectionSQLExceptionpublic void setSchema(String schema) throws SQLException
setSchema in interface ConnectionSQLExceptionpublic void abort(Executor executor) throws SQLException
abort in interface ConnectionSQLExceptionpublic void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException
setNetworkTimeout in interface ConnectionSQLExceptionpublic int getNetworkTimeout()
throws SQLException
getNetworkTimeout in interface ConnectionSQLExceptionpublic void setHoldability(int holdability)
throws SQLException
setHoldability in interface ConnectionSQLExceptionpublic int getHoldability()
throws SQLException
getHoldability in interface ConnectionSQLExceptionpublic Savepoint setSavepoint() throws SQLException
setSavepoint in interface ConnectionSQLExceptionpublic Savepoint setSavepoint(String name) throws SQLException
setSavepoint in interface ConnectionSQLExceptionpublic void rollback(Savepoint savepoint) throws SQLException
rollback in interface ConnectionSQLExceptionpublic void releaseSavepoint(Savepoint savepoint) throws SQLException
releaseSavepoint in interface ConnectionSQLExceptionpublic Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
createStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareCall in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic final Map<String,String> getParameterStatuses()
RedshiftConnectionReturns the current values of all parameters reported by the server.
Redshift reports values for a subset of parameters (GUCs) to the client
at connect-time, then sends update messages whenever the values change
during a session. PgJDBC records the latest values and exposes it to client
applications via getParameterStatuses().
PgJDBC exposes individual accessors for some of these parameters as listed below. They are more backwarrds-compatible and should be preferred where possible.
Not all parameters are reported, only those marked
GUC_REPORT in the source code. The pg_settings
view does not expose information about which parameters are reportable.
PgJDBC's map will only contain the parameters the server reports values
for, so you cannot use this method as a substitute for running a
SHOW paramname; or SELECT
current_setting('paramname'); query for arbitrary parameters.
Parameter names are case-insensitive and case-preserving
in this map, like in Redshift itself. So DateStyle and
datestyle are the same key.
As of PostgreSQL 11 the reportable parameter list, and related PgJDBC interfaces or accesors, are:
application_name -
Connection.getClientInfo(),
Connection.setClientInfo(java.util.Properties)
and ApplicationName connection property.
client_encoding - PgJDBC always sets this to UTF8.
See allowEncodingChanges connection property.
DateStyle - PgJDBC requires this to always be set to ISOstandard_conforming_strings - indirectly via RedshiftConnection.escapeLiteral(String)TimeZone - set from JDK timezone see TimeZone.getDefault()
and TimeZone.setDefault(TimeZone)
integer_datetimesIntervalStyleserver_encodingserver_versionis_superuser session_authorizationNote that some PgJDBC operations will change server parameters automatically.
getParameterStatuses in interface RedshiftConnectionpublic final String getParameterStatus(String parameterName)
RedshiftConnectiongetParameterStatus in interface RedshiftConnectionparameterName - case-insensitive parameter nameRedshiftConnection.getParameterStatuses()public static String getOptionalSetting(String key, Properties info)
key - The name of the setting to retrieve.info - The connection settings generated by a call to
UpdateConnectionSettings().public static String getOptionalConnSetting(String key, Properties info)
public static String getRequiredSetting(String key, Properties info) throws RedshiftException
key - The name of the setting to retrieve.info - The connection settings generated by a call to
UpdateConnectionSettings().RedshiftException - If the required setting isn't present.public static String getRequiredConnSetting(String key, Properties info) throws RedshiftException
RedshiftExceptionCopyright © 2024 Amazon.com Inc.. All rights reserved.