| Modifier and Type | Method and Description |
|---|---|
| public void | addDataType(String
JDBC type name type, String class name className)
Deprecated
As of 8.0, replaced by
addDataType(String, Class).
This allows client code to add a handler for one of org.postgresql's more unique data types. |
| public void | addDataType(String
the PostgreSQL type to register type, Class<? extends PGobject> the class implementing the Java representation of the type; this class must
implement klass)org.).This allows client code to add a handler for one of org.postgresql's more unique data types. |
| public default void | alterUserPassword(String
The username of the database user user, char[] The new password for the database user. The implementation will zero
out the array after use newPassword, @Nullable String The type of password encryption to use or null if the database server default should be used. encryptionType)Change a user's password to the specified new password. |
| public void | |
| public Array | |
| public String | Returns: the escaped identifierinput identifier identifier)Return the given string suitably quoted to be used as an identifier in an SQL statement string. |
| public String | Returns: the quoted literalinput literal literal)Return the given string suitably quoted to be used as a string literal in an SQL statement string. |
| public boolean | Returns: state of adaptive fetch (turned on or off)Get state of adaptive fetch for connection. |
| public AutoSave | Returns: connection configuration regarding automatic per-query savepointsConnection configuration regarding automatic per-query savepoints. |
| public int | Returns: PID of backend server process.Return the process ID (PID) of the backend server process handling this connection. |
| public CopyManager | Returns: COPY API for the current connectionThis returns the COPY API for the current connection. |
| public int | Returns: current state for default fetch sizeGet the default fetch size for statements created from this connection. |
| public Fastpath | Returns: Fastpath API for the current connection
Deprecated
This API is somewhat obsolete, as one may achieve similar performance
and greater functionality by setting up a prepared statement to define
the function call.
This returns the Fastpath API for the current connection. |
| public LargeObjectManager | Returns: LargeObject API for the current connectionThis returns the LargeObject API for the current connection. |
| public PGNotification[] | Returns: notifications that have been receivedThis method returns any notifications that have been received since the last call to this method. |
| public PGNotification[] | Returns: notifications that have been receivedwhen 0, blocks forever. when > 0, blocks up to the specified number of millis
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. timeoutMillis)This method returns any notifications that have been received since the last call to this method. |
| public @Nullable String | Returns: parameter value if defined, or null if no parameter knowncase-insensitive parameter name parameterName)Shorthand for getParameterStatuses().get(...) . |
| public Map | Returns: unmodifiable map of case-insensitive parameter names to parameter valuesReturns the current values of all parameters reported by the server. |
| public PreferQueryMode | |
| public int | Returns: the current thresholdGet the default server-side prepare reuse threshold for statements created from this connection. |
| public PGReplicationConnection | |
| public void | setAdaptiveFetch(boolean
desired state of adaptive fetch. adaptiveFetch)Turn on/off adaptive fetch for connection. |
| public void | setAutosave(AutoSave
connection configuration regarding automatic per-query savepoints autoSave)Configures if connection should use automatic savepoints. |
| public void | setDefaultFetchSize(int
new default fetch size fetchSize)Set the default fetch size for statements created from this connection. |
| public void | setPrepareThreshold(int
the new threshold threshold)Set the default statement reuse threshold before enabling server-side prepare. |
| addDataType | back to summary |
|---|---|
| public void addDataType(String type, String className)
Deprecated As of 8.0, replaced by This allows client code to add a handler for one of org.postgresql's more unique data types. It
is approximately equivalent to
| |
| addDataType | back to summary |
|---|---|
| public void addDataType(String type, Class<? extends PGobject> klass) throws 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
| |
| alterUserPassword | back to summary |
|---|---|
| public default void alterUserPassword(String user, char[] newPassword, @Nullable String encryptionType) throws SQLException Change a user's password to the specified new password. If the specific encryption type is not specified, this method defaults to querying the database server for the server's default password_encryption. This method does not send the new password in plain text to the server. Instead, it encrypts the password locally and sends the encoded hash so that the plain text password is never sent on the wire. Acceptable values for encryptionType are null, "md5", or "scram-sha-256". Users should avoid "md5" unless they are explicitly targeting an older server that does not support the more secure SCRAM.
| |
| cancelQuery | back to summary |
|---|---|
| public void cancelQuery() throws SQLException Sends a query cancellation for this connection.
| |
| createArrayOf | back to summary |
|---|---|
| public Array createArrayOf(String typeName, @Nullable Object elements) throws SQLException Creates an
| |
| escapeIdentifier | back to summary |
|---|---|
| public String escapeIdentifier(String identifier) throws SQLException Return the given string suitably quoted to be used as an identifier in an SQL statement string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be case-folded). Embedded quotes are properly doubled.
| |
| escapeLiteral | back to summary |
|---|---|
| public String escapeLiteral(String literal) throws SQLException Return the given string suitably quoted to be used as a string literal in an SQL statement string. Embedded single-quotes and backslashes are properly doubled. Note that quote_literal returns null on null input.
| |
| getAdaptiveFetch | back to summary |
|---|---|
| public boolean getAdaptiveFetch() Get state of adaptive fetch for connection.
| |
| getAutosave | back to summary |
|---|---|
| public AutoSave getAutosave() Connection configuration regarding automatic per-query savepoints.
| |
| getBackendPID | back to summary |
|---|---|
| public int getBackendPID() Return the process ID (PID) of the backend server process handling this connection.
| |
| getCopyAPI | back to summary |
|---|---|
| public CopyManager getCopyAPI() throws SQLException This returns the COPY API for the current connection.
| |
| getDefaultFetchSize | back to summary |
|---|---|
| public int getDefaultFetchSize() Get the default fetch size for statements created from this connection.
| |
| getFastpathAPI | back to summary |
|---|---|
| public Fastpath getFastpathAPI() throws SQLException
Deprecated This API is somewhat obsolete, as one may achieve similar performance and greater functionality by setting up a prepared statement to define the function call. Then, executing the statement with binary transmission of parameters and results substitutes for a fast-path function call. This returns the Fastpath API for the current connection.
| |
| getLargeObjectAPI | back to summary |
|---|---|
| public LargeObjectManager getLargeObjectAPI() throws SQLException This returns the LargeObject API for the current connection.
| |
| getNotifications | back to summary |
|---|---|
| public PGNotification[] getNotifications() throws 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.
| |
| getNotifications | back to summary |
|---|---|
| public PGNotification[] getNotifications(int timeoutMillis) throws 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. A timeout can be specified so the driver waits for notifications.
| |
| getParameterStatus | back to summary |
|---|---|
| public @Nullable String getParameterStatus(String parameterName) Shorthand for getParameterStatuses().get(...) .
| |
| getParameterStatuses | back to summary |
|---|---|
| public Map Returns the current values of all parameters reported by the server. PostgreSQL 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 PgJDBC exposes individual accessors for some of these parameters as listed below. They are more backwards-compatible and should be preferred where possible. Not all parameters are reported, only those marked
Parameter names are case-insensitive and case-preserving
in this map, like in PostgreSQL itself. So As of PostgreSQL 11 the reportable parameter list, and related PgJDBC interfaces or assessors, are:
Note that some PgJDBC operations will change server parameters automatically. | |
| getPreferQueryMode | back to summary |
|---|---|
| public PreferQueryMode getPreferQueryMode() Returns 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.
| |
| getPrepareThreshold | back to summary |
|---|---|
| public int getPrepareThreshold() Get the default server-side prepare reuse threshold for statements created from this connection.
| |
| getReplicationAPI | back to summary |
|---|---|
public PGReplicationConnection getReplicationAPI()
| |
| setAdaptiveFetch | back to summary |
|---|---|
| public void setAdaptiveFetch(boolean adaptiveFetch) Turn on/off adaptive fetch for connection. Existing statements and resultSets won't be affected by change here.
| |
| setAutosave | back to summary |
|---|---|
| public void setAutosave(AutoSave autoSave) Configures if connection should use automatic savepoints.
| |
| setDefaultFetchSize | back to summary |
|---|---|
| public void setDefaultFetchSize(int fetchSize) throws SQLException Set the default fetch size for statements created from this connection.
| |
| setPrepareThreshold | back to summary |
|---|---|
| public void setPrepareThreshold(int threshold) Set the default statement reuse threshold before enabling server-side prepare. See
| |