com.pivotal.gemfirexd.internal.client.net

## Class NetConnection40

- java.lang.Object
- - com.pivotal.gemfirexd.internal.client.am.Connection
  - - com.pivotal.gemfirexd.internal.client.net.NetConnection
    - - com.pivotal.gemfirexd.internal.client.net.NetConnection40

All Implemented Interfaces:
  ConnectionCallbackInterface, AutoCloseable, Connection, Wrapper

    public class NetConnection40
    extends NetConnection

### Nested Class Summary

### Nested classes/interfaces inherited from class com.pivotal.gemfirexd.internal.client.net.NetConnection

`NetConnection.ConnectionCreator, NetConnection.DSConnectionInfo`

### Nested classes/interfaces inherited from class com.pivotal.gemfirexd.internal.client.am.Connection

`Connection.FailoverStatus`

### Field Summary

### Fields inherited from class com.pivotal.gemfirexd.internal.client.net.NetConnection

`addrPat_, BUCKET_AND_SERVER_PROC_QUERY, cnntkn_, connServer, connUrl, connUrl2, crrtkn_, currXACallInfoOffset_, failoverSQLStateArray, getBucketToServerDetails_, gotException_, indoubtTransactions_, MAX_SERVER_LIMIT, msgutil, netAgent_, pendingEndXACallinfoOffset_, pwFactory, rand, readOnlyTransaction_, securityMechanism_, statementFailover_, targetAgent_, targetCmnappc_, targetCmntcpip_, targetRdb_, targetRsyncmgr_, targetSecmgr_, targetSrvclsnm_, targetSrvnam_, targetSrvrlslv_, targetSyncptmgr_, targetXamgr_, xares_`

### Fields inherited from class com.pivotal.gemfirexd.internal.client.am.Connection

`agent_, alternateNetServers_, autoCommit_, clientSSLMode_, commBufferSize_, currentSchemaName_, currTXID, databaseMetaData_, databaseName_, dataSource_, DEFAULT_LOGIN_TIMEOUT, DEFAULT_SINGLE_HOP_MAX_CONN_PER_SERVER, defaultIsolation_, disableCancel_, disableStreaming_, disableTXBatching_, dncGeneratedSavepointId_, dncGeneratedSavepointNamePrefix__, doSetSchema_, encryptionManager_, executionSequence, INFINITE_LOGIN_TIMEOUT, inUnitOfWork_, isolation_, isXAConnection_, jdbcReadOnly_, keepAliveCnt_, keepAliveIdle_, keepAliveIntvl_, loadBalance_, lobProcs, loginTimeout_, ncjBatchSize_, ncjCacheSize_, portNumber_, prevSuccessfulSeq, productID_, queryHDFS_, resetConnectionAtFirstSql_, retrieveMessageText_, serverModifyLevel_, serverNameIP_, serverReleaseLevel_, serverVersion, serverVersionLevel_, SINGLE_HOP_MAX_CONN_PER_SERVER, singleHopAttempted, singleHopEnabled_, skipConstraints_, skipListeners_, skipLocks_, successfulExecutionSequence, syncCommits_, TRANSACTION_UNKNOWN, useBoundedQueuePool_, user_, XA_T0_NOT_ASSOCIATED, XA_T1_ASSOCIATED, xaHostVersion_`

### Fields inherited from interface java.sql.Connection

`TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE`

### Constructor Summary

Constructors
Constructor and Description
`NetConnection40(NetLogWriter netLogWriter, ClientBaseDataSource dataSource, String user, String password)`
`NetConnection40(NetLogWriter netLogWriter, int driverManagerLoginTimeout, String serverName, int portNumber, String databaseName, Properties properties)`
`NetConnection40(NetLogWriter netLogWriter, String ipaddr, int portNumber, ClientBaseDataSource dataSource, boolean isXAConn)`
`NetConnection40(NetLogWriter netLogWriter, String databaseName, Properties properties)`
`NetConnection40(NetLogWriter netLogWriter, String user, String password, ClientBaseDataSource dataSource, int rmId, boolean isXAConn)`
`NetConnection40(NetLogWriter netLogWriter, String user, String password, ClientBaseDataSource dataSource, int rmId, boolean isXAConn, ClientPooledConnection cpc)` The constructor for the NetConnection40 class which contains implementations of JDBC 4.0 specific methods in the java.sql.Connection interface.

### Method Summary

Methods
`void` `abort(Executor executor)`
`void` `close()` Close the connection and release its resources.
`Array` `createArrayOf(String typeName, Object[] elements)`
`NClob` `createNClob()`
`SQLXML` `createSQLXML()`
`Struct` `createStruct(String typeName, Object[] attributes)`
`Properties` `getClientInfo()` `getClientInfo` always returns an empty `Properties` object since Derby doesn't support ClientInfoProperties.
`String` `getClientInfo(String name)` `getClientInfo` always returns a `null String` since Derby doesn't support ClientInfoProperties.
`int` `getNetworkTimeout()`
`String` `getSchema()`
`Map<String,Class<?>>` `getTypeMap()` Returns the type map for this connection.
`boolean` `isValid(int timeout)` Checks if the connection has not been closed and is still valid.
`boolean` `isWrapperFor(Class<?> interfaces)` Returns false unless `interfaces` is implemented
`void` `setClientInfo(Properties properties)` `setClientInfo` will throw a `SQLClientInfoException` uless the `properties` paramenter is empty, since Derby does not support any properties.
`void` `setClientInfo(String name, String value)` `setClientInfo` will always throw a `SQLClientInfoException` since Derby does not support any properties.
`void` `setNetworkTimeout(Executor executor, int milliseconds)`
`void` `setSchema(String schema)`
`<T> T` `unwrap(Class<T> interfaces)` Returns `this` if this class implements the interface

### Methods inherited from class com.pivotal.gemfirexd.internal.client.net.NetConnection

`addSpecialRegisters, allowCloseInUOW_, allowLocalCommitRollback_, checkAlternateServerHasEqualOrHigherProductLevel, closeForReuse, closeResources, closeX, completeConnect, completeReset, constructCrrtkn, createNewAgentOrReset, doCloseStatementsOnClose_, doFailoverOnException, doResetNow, finalize, flowConnect, flowReconnect, flowSimpleConnect, getAGENT, getCachedIsolation, getCMNTCPIP, getCnnToken, getConnectionProperties, getConnectionProperties, getDSConnectionInfo, getEncryptionManager, getFailoverStatus, getInputStream, getOutputStream, getProductID, getRDB, getRSYNCMGR, getSavePointToRollbackTo, getSECMGR, getSecurityMechanism, getSendBufferSize, getSequenceNumber, getServerLocation, getServerUrl, getServerUrl, getSocketAndInputOutputStreams, getSQLAM, getSYNCPTMGR, getTargetPublicKey, getTimeout, getTxID, getXAMGR, handleFailover, handleFailover, isConnectionNull, isGlobalPending_, isSnappyDRDAProtocol, markClosed_, newAgent_, newCallableStatement_, newDatabaseMetaData_, newPositionedUpdatePreparedStatement_, newPreparedStatement_, newSectionManager, newStatement_, preAgentInitialize, readCommitSubstitute_, readLocalCommit_, readLocalRollback_, readLocalXACommit_, readLocalXARollback_, readLocalXAStart_, readTransactionStart, readXACommit_, readXARollback_, reset_, resetCallableStatement_, resetNetConnection, resetPreparedStatement_, resetStatement_, serverSupportsLayerBStreaming, serverSupportsLocators, serverSupportsQryclsimp, serverSupportsUDTs, setBaseConnection, setConnectionNull, setIndoubtTransactions, setInputStream, setOutputStream, setReadOnlyTransactionFlag, setSendBufferSize, setServerURL, setServerVersion, setTimeout, setTXID, supportsSessionDataCaching, toString, updateRegionInfoForCommit, willAutoCommitGenerateFlow, writeCommitSubstitute_, writeLocalCommit_, writeLocalRollback_, writeLocalXACommit_, writeLocalXARollback_, writeLocalXAStart_, writeTransactionStart, writeXACommit_, writeXARollback_, writeXATransactionStart`

### Methods inherited from class com.pivotal.gemfirexd.internal.client.am.Connection

`accumulate440WarningForMessageProcFailure, accumulate444WarningForMessageProcFailure, accumulateWarning, cancelDisabled, checkForClosedConnection, clearWarnings, clearWarningsX, closeForReuse, commit, completeAbnormalUnitOfWork, completeAbnormalUnitOfWork, completeChainBreakingDisconnect, completeInitialPiggyBackIsolation, completeInitialPiggyBackSchema, completeLocalCommit, completeLocalRollback, completePiggyBackIsolation, completePiggyBackSchema, completeReset, completeReset, completeServerVersion, completeSpecificRollback, completeSqlca, createBlob, createClob, createStatement, createStatement, createStatement, flowAutoCommit, flowCommit, flowRollback, getAutoCommit, getCatalog, getCurrentSchemaName, getHoldability, getMetaData, getServerVersion, getTransactionID, getTransactionIsolation, getTransactionIsolationX, getWarnings, getXAState, incrementAndGetExecutionSequence, init, initConnection, initialize, isClosed, isClosedX, isOpen, isPhysicalConnClosed, isReadOnly, isSingleHopEnabled, isXAConnection, lightReset, locatorProcedureCall, markClosed, markClosed, markOpen, nativeSQL, nativeSQLX, prepareCall, prepareCall, prepareCall, prepareMessageProc, preparePositionedUpdateStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, readCommit, readRollback, releaseSavepoint, reset, resetConnection, resetPrepareCall, resetPrepareStatement, resetStatement, rollback, rollback, setAutoCommit, setAutoCommitX, setCatalog, setHoldability, setInUnitOfWork, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTransactionIsolationX, setTypeMap, setXAState, transactionInProgress, writeCommit, writeRollback`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### NetConnection40

    public NetConnection40(NetLogWriter netLogWriter,
                   String databaseName,
                   Properties properties)
                    throws SqlException

Throws:
  `SqlException`

#### NetConnection40

    public NetConnection40(NetLogWriter netLogWriter,
                   ClientBaseDataSource dataSource,
                   String user,
                   String password)
                    throws SqlException

Throws:
  `SqlException`

#### NetConnection40

    public NetConnection40(NetLogWriter netLogWriter,
                   int driverManagerLoginTimeout,
                   String serverName,
                   int portNumber,
                   String databaseName,
                   Properties properties)
                    throws SqlException

Throws:
  `SqlException`

#### NetConnection40

    public NetConnection40(NetLogWriter netLogWriter,
                   String user,
                   String password,
                   ClientBaseDataSource dataSource,
                   int rmId,
                   boolean isXAConn)
                    throws SqlException

Throws:
  `SqlException`

#### NetConnection40

    public NetConnection40(NetLogWriter netLogWriter,
                   String ipaddr,
                   int portNumber,
                   ClientBaseDataSource dataSource,
                   boolean isXAConn)
                    throws SqlException

Throws:
  `SqlException`

#### NetConnection40

    public NetConnection40(NetLogWriter netLogWriter,
                   String user,
                   String password,
                   ClientBaseDataSource dataSource,
                   int rmId,
                   boolean isXAConn,
                   ClientPooledConnection cpc)
                    throws SqlException

The constructor for the NetConnection40 class which contains implementations of JDBC 4.0 specific methods in the java.sql.Connection interface. This constructor is called from the ClientPooledConnection object to enable the NetConnection to pass `this` on to the associated prepared statement object thus enabling the prepared statement object to inturn raise the statement events to the ClientPooledConnection object.

Parameters:
  `netLogWriter` - NetLogWriter object associated with this connection.
  `user` - user id for this connection.
  `password` - password for this connection.
  `dataSource` - The DataSource object passed from the PooledConnection object from which this constructor was called.
  `rmId` - The Resource manager ID for XA Connections
  `isXAConn` - true if this is a XA connection.
  `cpc` - The ClientPooledConnection object from which this NetConnection constructor was called. This is used to pass StatementEvents back to the pooledConnection object.
Throws:
  `SqlException`

### Method Detail

#### createArrayOf

    public Array createArrayOf(String typeName,
                      Object[] elements)
                        throws SQLException

Throws:
  `SQLException`

#### createNClob

    public NClob createNClob()
                      throws SQLException

Throws:
  `SQLException`

#### createSQLXML

    public SQLXML createSQLXML()
                        throws SQLException

Throws:
  `SQLException`

#### createStruct

    public Struct createStruct(String typeName,
                      Object[] attributes)
                        throws SQLException

Throws:
  `SQLException`

#### isValid

    public boolean isValid(int timeout)
                    throws SQLException

Checks if the connection has not been closed and is still valid. The validity is checked by running a simple query against the database. The timeout specified by the caller is implemented as follows: On the server: uses the queryTimeout functionality to make the query time out on the server in case the server has problems or is highly loaded. On the client: uses a timeout on the socket to make sure that the client is not blocked forever in the cases where the server is "hanging" or not sending the reply.

Parameters:
  `timeout` - The time in seconds to wait for the database operation used to validate the connection to complete. If the timeout period expires before the operation completes, this method returns false. A value of 0 indicates a timeout is not applied to the database operation.
Returns:
  true if the connection is valid, false otherwise
Throws:
  `SQLException` - if the parameter value is illegal or if a database error has occured

#### close

    public void close()
               throws SQLException

Close the connection and release its resources.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Connection`
Overrides:
  `close` in class `NetConnection`
Throws:
  `SQLException` - if a database-access error occurs.

#### setClientInfo

    public void setClientInfo(String name,
                     String value)
                       throws SQLClientInfoException

`setClientInfo` will always throw a `SQLClientInfoException` since Derby does not support any properties.

Parameters:
  `name` - a property key `String`
  `value` - a property value `String`
Throws:
  `SQLException` - always.
  `SQLClientInfoException`

#### setClientInfo

    public void setClientInfo(Properties properties)
                       throws SQLClientInfoException

`setClientInfo` will throw a `SQLClientInfoException` uless the `properties` paramenter is empty, since Derby does not support any properties. All the property keys in the `properties` parameter are added to failedProperties of the exception thrown, with REASON_UNKNOWN_PROPERTY as the value.

Parameters:
  `properties` - a `Properties` object with the properties to set.
Throws:
  `SQLClientInfoException` - unless the properties parameter is null or empty.

#### getClientInfo

    public String getClientInfo(String name)
                         throws SQLException

`getClientInfo` always returns a `null String` since Derby doesn't support ClientInfoProperties.

Parameters:
  `name` - a `String` value
Returns:
  a `null String` value
Throws:
  `SQLException` - if the connection is closed.

#### getClientInfo

    public Properties getClientInfo()
                             throws SQLException

`getClientInfo` always returns an empty `Properties` object since Derby doesn't support ClientInfoProperties.

Returns:
  an empty `Properties` object.
Throws:
  `SQLException` - if the connection is closed.

#### getTypeMap

    public final Map<String,Class<?>> getTypeMap()
                                          throws SQLException

Returns the type map for this connection.

Specified by:
  `getTypeMap` in interface `Connection`
Overrides:
  `getTypeMap` in class `Connection`
Returns:
  type map for this connection
Throws:
  `SQLException` - if a database access error occurs

#### isWrapperFor

    public boolean isWrapperFor(Class<?> interfaces)
                         throws SQLException

Returns false unless `interfaces` is implemented

Parameters:
  `interfaces` - a Class defining an interface.
Returns:
  true if this implements the interface or directly or indirectly wraps an object that does.
Throws:
  `SQLException` - if an error occurs while determining whether this is a wrapper for an object with the given interface.

#### unwrap

    public <T> T unwrap(Class<T> interfaces)
             throws SQLException

Returns `this` if this class implements the interface

Parameters:
  `interfaces` - a Class defining an interface
Returns:
  an object that implements the interface
Throws:
  `SQLException` - if no object if found that implements the interface

#### setSchema

    public void setSchema(String schema)
                   throws SQLException

Throws:
  `SQLException`

#### getSchema

    public String getSchema()
                     throws SQLException

Throws:
  `SQLException`

#### abort

    public void abort(Executor executor)
               throws SQLException

Throws:
  `SQLException`

#### setNetworkTimeout

    public void setNetworkTimeout(Executor executor,
                         int milliseconds)
                           throws SQLException

Throws:
  `SQLException`

#### getNetworkTimeout

    public int getNetworkTimeout()
                          throws SQLException

Throws:
  `SQLException`