PGConnection
Keywords: org.postgresql.PGConnection interface

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.postgresql
Interface PGConnection

    public interface PGConnection

This interface defines the public PostgreSQL extensions to java.sql.Connection. All Connections returned by the PostgreSQL driver implement PGConnection.

Method Summary
`void` | `addDataType(java.lang.String type, java.lang.Class klass)` This allows client code to add a handler for one of org.postgresql's more unique data types.
`void` | `addDataType(java.lang.String type, java.lang.String name)` Deprecated. As of 8.0, replaced by `addDataType(String,Class)`. This deprecated method does not work correctly for registering classes that cannot be directly loaded by the JDBC driver's classloader.
`org.postgresql.core.Encoding` | `getEncoding()` Deprecated.
`Fastpath` | `getFastpathAPI()` This returns the Fastpath API for the current connection.
`LargeObjectManager` | `getLargeObjectAPI()` This returns the LargeObject API for the current connection.
`PGNotification[]` | `getNotifications()` This method returns any notifications that have been received since the last call to this method.
`java.lang.Object` | `getObject(java.lang.String type, java.lang.String value)` Deprecated.
`java.lang.String` | `getPGType(int oid)` Deprecated.
`int` | `getPGType(java.lang.String typeName)` Deprecated.
`int` | `getPrepareThreshold()` Get the default server-side prepare reuse threshold for statements created from this connection.
`int` | `getSQLType(int oid)` Deprecated.
`int` | `getSQLType(java.lang.String pgTypeName)` Deprecated.
`void` | `setPrepareThreshold(int threshold)` Set the default statement reuse threshold before enabling server-side prepare.

Method Detail

### getNotifications

    PGNotification[] getNotifications()
                                      throws java.sql.SQLException

  This method returns any notifications that have been received since the last call to this method. Returns null if there have been no notifications.

  Throws:
    `java.sql.SQLException`
  Since:
    7.3

### getLargeObjectAPI

    LargeObjectManager getLargeObjectAPI()
                                         throws java.sql.SQLException

  This returns the LargeObject API for the current connection.

  Throws:
    `java.sql.SQLException`
  Since:
    7.3

### getFastpathAPI

    Fastpath getFastpathAPI()
                            throws java.sql.SQLException

  This returns the Fastpath API for the current connection.

  Throws:
    `java.sql.SQLException`
  Since:
    7.3

### addDataType

    void addDataType(java.lang.String type,
                     java.lang.String name)

  Deprecated. As of 8.0, replaced by `addDataType(String,Class)`. This deprecated method does not work correctly for registering classes that cannot be directly loaded by the JDBC driver's classloader.

  This allows client code to add a handler for one of org.postgresql's more unique data types. It is approximately equivalent to `addDataType(type, Class.forName(name))`.

  Throws:
    `java.lang.RuntimeException` - if the type cannot be registered (class not found, etc).

### addDataType

    void addDataType(java.lang.String type,
                     java.lang.Class klass)
                     throws java.sql.SQLException

  This allows client code to add a handler for one of org.postgresql's more unique data types.

  NOTE: This is not part of JDBC, but an extension.

  The best way to use this is as follows:

       ...
       ((org.postgresql.PGConnection)myconn).addDataType("mytype", my.class.name.class);
       ...

  where myconn is an open Connection to org.postgresql.

  The handling class must extend org.postgresql.util.PGobject

  Parameters:
    `type` - the PostgreSQL type to register
    `klass` - the class implementing the Java representation of the type; this class must implement `PGobject`).
  Throws:
    `java.sql.SQLException` - if `klass` does not implement `PGobject`).
  Since:
    8.0
  See Also:
    `PGobject`

### setPrepareThreshold

    void setPrepareThreshold(int threshold)

  Set the default statement reuse threshold before enabling server-side prepare. See `PGStatement.setPrepareThreshold(int)` for details.

  Parameters:
    `threshold` - the new threshold
  Since:
    build 302

### getPrepareThreshold

    int getPrepareThreshold()

  Get the default server-side prepare reuse threshold for statements created from this connection.

  Returns:
    the current threshold
  Since:
    build 302

### getEncoding

    org.postgresql.core.Encoding getEncoding()
                                             throws java.sql.SQLException

  Deprecated.

  Throws:
    `java.sql.SQLException`

### getSQLType

    int getSQLType(java.lang.String pgTypeName)
                   throws java.sql.SQLException

  Deprecated.

  Throws:
    `java.sql.SQLException`

### getSQLType

    int getSQLType(int oid)
                   throws java.sql.SQLException

  Deprecated.

  Throws:
    `java.sql.SQLException`

### getPGType

    java.lang.String getPGType(int oid)
                               throws java.sql.SQLException

  Deprecated.

  Throws:
    `java.sql.SQLException`

### getPGType

    int getPGType(java.lang.String typeName)
                  throws java.sql.SQLException

  Deprecated.

  Throws:
    `java.sql.SQLException`

### getObject

    java.lang.Object getObject(java.lang.String type,
                               java.lang.String value)
                               throws java.sql.SQLException

  Deprecated.

  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD