Skip to content

Commit c9333e7

Browse files
authored
feat: add support of PGvector (#1494)
1 parent b943658 commit c9333e7

File tree

5 files changed

+81
-20
lines changed

5 files changed

+81
-20
lines changed

docs/using-the-jdbc-driver/UsingTheJdbcDriver.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,26 @@ logging.level.software.amazon.jdbc=trace
7272
## AWS Advanced JDBC Driver Parameters
7373
These parameters are applicable to any instance of the AWS JDBC Driver.
7474

75-
| Parameter | Value | Required | Description | Default Value |
76-
|---------------------------------------------------|-----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
77-
| `wrapperLoggerLevel` | `String` | No | Logger level of the AWS JDBC Driver. <br><br/>If it is used, it must be one of the following values: `OFF`, `SEVERE`, `WARNING`, `INFO`, `CONFIG`, `FINE`, `FINER`, `FINEST`, `ALL`. | `null` |
78-
| `database` | `String` | No | Database name. | `null` |
79-
| `user` | `String` | No | Database username. | `null` |
80-
| `password` | `String` | No | Database password. | `null` |
81-
| `wrapperDialect` | `String` | No | Please see [this page on database dialects](./DatabaseDialects.md), and whether you should include it. | `null` |
82-
| `wrapperLogUnclosedConnections` | `Boolean` | No | Allows the AWS JDBC Driver to capture a stacktrace for each connection that is opened. If the `finalize()` method is reached without the connection being closed, the stacktrace is printed to the log. This helps developers to detect and correct the source of potential connection leaks. | `false` |
83-
| `loginTimeout` | `Integer` | No | Login timeout in milliseconds. | `null` |
84-
| `connectTimeout` | `Integer` | No | Socket connect timeout in milliseconds. | `null` |
85-
| `socketTimeout` | `Integer` | No | Socket timeout in milliseconds. | `null` |
86-
| `tcpKeepAlive` | `Boolean` | No | Enable or disable TCP keep-alive probe. | `false` |
87-
| `targetDriverAutoRegister` | `Boolean` | No | Allows the AWS JDBC Driver to register a target driver based on `wrapperTargetDriverDialect` configuration parameter or, if it's missed, on a connection url protocol. | `true` |
88-
| `transferSessionStateOnSwitch` | `Boolean` | No | Enables transferring the session state to a new connection. | `true` |
89-
| `resetSessionStateOnClose` | `Boolean` | No | Enables resetting the session state before closing connection. | `true` |
90-
| `rollbackOnSwitch` | `Boolean` | No | Enables rolling back a current transaction, if any in effect, before switching to a new connection. | `true` |
91-
| `awsProfile` | `String` | No | Allows users to specify a profile name for AWS credentials. This parameter is used by plugins that require AWS credentials, like the [IAM Authentication Connection Plugin](./using-plugins/UsingTheIamAuthenticationPlugin.md) and the [AWS Secrets Manager Connection Plugin](./using-plugins/UsingTheAwsSecretsManagerPlugin.md). | `null` |
92-
| `enableGreenNodeReplacement` | `Boolean` | No | Enables replacing a green node host name with the original host name when the green host DNS doesn't exist anymore after a blue/green switchover. Refer to [Overview of Amazon RDS Blue/Green Deployments](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments-overview.html) for more details about green and blue nodes. | `false` |
93-
| `wrapperCaseSensitive`,<br>`wrappercasesensitive` | `Boolean` | No | Allows the driver to change case sensitivity for parameter names in the connection string and in connection properties. Set parameter to `false` to allow case-insensitive parameter names. | `true` |
75+
| Parameter | Value | Required | Description | Default Value |
76+
|---------------------------------------------------|-----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
77+
| `wrapperLoggerLevel` | `String` | No | Logger level of the AWS JDBC Driver. <br><br/>If it is used, it must be one of the following values: `OFF`, `SEVERE`, `WARNING`, `INFO`, `CONFIG`, `FINE`, `FINER`, `FINEST`, `ALL`. | `null` |
78+
| `database` | `String` | No | Database name. | `null` |
79+
| `user` | `String` | No | Database username. | `null` |
80+
| `password` | `String` | No | Database password. | `null` |
81+
| `wrapperDialect` | `String` | No | Please see [this page on database dialects](./DatabaseDialects.md), and whether you should include it. | `null` |
82+
| `wrapperLogUnclosedConnections` | `Boolean` | No | Allows the AWS JDBC Driver to capture a stacktrace for each connection that is opened. If the `finalize()` method is reached without the connection being closed, the stacktrace is printed to the log. This helps developers to detect and correct the source of potential connection leaks. | `false` |
83+
| `loginTimeout` | `Integer` | No | Login timeout in milliseconds. | `null` |
84+
| `connectTimeout` | `Integer` | No | Socket connect timeout in milliseconds. | `null` |
85+
| `socketTimeout` | `Integer` | No | Socket timeout in milliseconds. | `null` |
86+
| `tcpKeepAlive` | `Boolean` | No | Enable or disable TCP keep-alive probe. | `false` |
87+
| `targetDriverAutoRegister` | `Boolean` | No | Allows the AWS JDBC Driver to register a target driver based on `wrapperTargetDriverDialect` configuration parameter or, if it's missed, on a connection url protocol. | `true` |
88+
| `transferSessionStateOnSwitch` | `Boolean` | No | Enables transferring the session state to a new connection. | `true` |
89+
| `resetSessionStateOnClose` | `Boolean` | No | Enables resetting the session state before closing connection. | `true` |
90+
| `rollbackOnSwitch` | `Boolean` | No | Enables rolling back a current transaction, if any in effect, before switching to a new connection. | `true` |
91+
| `awsProfile` | `String` | No | Allows users to specify a profile name for AWS credentials. This parameter is used by plugins that require AWS credentials, like the [IAM Authentication Connection Plugin](./using-plugins/UsingTheIamAuthenticationPlugin.md) and the [AWS Secrets Manager Connection Plugin](./using-plugins/UsingTheAwsSecretsManagerPlugin.md). | `null` |
92+
| `enableGreenNodeReplacement` | `Boolean` | No | Enables replacing a green node host name with the original host name when the green host DNS doesn't exist anymore after a blue/green switchover. Refer to [Overview of Amazon RDS Blue/Green Deployments](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments-overview.html) for more details about green and blue nodes. | `false` |
93+
| `wrapperCaseSensitive`,<br>`wrappercasesensitive` | `Boolean` | No | Allows the driver to change case sensitivity for parameter names in the connection string and in connection properties. Set parameter to `false` to allow case-insensitive parameter names. | `true` |
94+
| `skipWrappingForPackages` | `String` | No | Register Java package names (separated by comma) which will be left unwrapped. This setting modifies all future connections established by the driver, not just a particular connection. | `com.pgvector` |
9495

9596
## Plugins
9697
The AWS JDBC Driver uses plugins to execute JDBC methods. You can think of a plugin as an extensible code module that adds extra logic around any JDBC method calls. The AWS JDBC Driver has a number of [built-in plugins](#list-of-available-plugins) available for use.
@@ -392,3 +393,19 @@ public static void main(String[] args) throws SQLException {
392393

393394
## Enable Logging
394395
To enable logging in the AWS JDBC Driver, change the `logger=StandardLogger` parameter to `wrapperLoggerLevel=FINEST`
396+
397+
## Enable Third Party Classes and Packages
398+
Depending on the requirements of a user's application, the AWS Advanced JDBC Driver performs special handling before and after operating on a database connection. This is achievable by wrapping over relevant data objects.
399+
400+
Not all data objects require special handling and thus can be left unwrapped. One example being classes from the PGVector package. The driver allows you to specify such classes and packages that should be left intact with no wrapping. If needed, use the following code snippet as an example to register data objects that should be left unwrapped.
401+
402+
```java
403+
Driver.skipWrappingForType(com.pgvector.PGvector.class);
404+
Driver.skipWrappingForType(com.pgvector.PGhalfvec.class);
405+
Driver.skipWrappingForType(com.pgvector.PGbit.class);
406+
407+
Driver.skipWrappingForPackage("com.pgvector");
408+
```
409+
This feature can be used to allow the AWS Advanced JDBC Driver to properly handle popular database extensions like [PGvector](https://github.com/pgvector/pgvector-java) and [PostGIS](https://github.com/postgis/postgis-java).
410+
411+
Using `Driver.skipWrappingForPackage()` method and using driver configuration parameter `skipWrappingForPackages` are functionally similar. The configuration parameter receives a comma separated list of package names while `Driver.skipWrappingForPackage()` accepts just one package at at time.

0 commit comments

Comments
 (0)