# Class DatabricksPooledConnection

java.lang.Object
com.databricks.jdbc.pooling.DatabricksPooledConnection

All Implemented Interfaces:
  `PooledConnection`

public class DatabricksPooledConnection extends Object implements PooledConnection

## Constructor Summary

Constructors
Constructor
Description
`DatabricksPooledConnection(Connection physicalConnection)`
Creates a new PooledConnection representing the specified physical connection.

## Method Summary

Modifier and Type
Method
Description
`void`
`addConnectionEventListener(ConnectionEventListener connectionEventListener)`
`void`
`addStatementEventListener(StatementEventListener listener)`
`void`
`close()`
Close the physical connection once the pooled connection is closed
`Connection`
`getConnection()`
Gets a handle for a client to use.
`Connection`
`getPhysicalConnection()`
`void`
`removeConnectionEventListener(ConnectionEventListener connectionEventListener)`
`void`
`removeStatementEventListener(StatementEventListener listener)`

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

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

## Constructor Details

### DatabricksPooledConnection

public DatabricksPooledConnection(Connection physicalConnection)
Creates a new PooledConnection representing the specified physical connection.

Parameters:
  `physicalConnection` - connection

## Method Details

### addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener connectionEventListener)

Specified by:
  `addConnectionEventListener` in interface `PooledConnection`

### removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener connectionEventListener)

Specified by:
  `removeConnectionEventListener` in interface `PooledConnection`

### removeStatementEventListener

public void removeStatementEventListener(StatementEventListener listener)

Specified by:
  `removeStatementEventListener` in interface `PooledConnection`

### addStatementEventListener

public void addStatementEventListener(StatementEventListener listener)

Specified by:
  `addStatementEventListener` in interface `PooledConnection`

### close

public void close() throws SQLException
Close the physical connection once the pooled connection is closed

Specified by:
  `close` in interface `PooledConnection`
Throws:
  `SQLException`

### getConnection

public Connection getConnection() throws SQLException
Gets a handle for a client to use. This is a wrapper around the physical connection, so the client can call close, and it will just return the connection to the pool without really closing the physical connection.

According to the JDBC 4.3 Optional Package spec (11.4), only one client may have an active handle to the connection at a time, so if there is a previous handle active when this is called, the previous one is forcibly closed.

Specified by:
  `getConnection` in interface `PooledConnection`
Throws:
  `SQLException`

### getPhysicalConnection

public Connection getPhysicalConnection()