Closed smileatom closed 5 months ago
Can you be more specific as to what the issue is that you are seeing?
Thank you for the report. Regarding the issue, the following code snippet:
public class DatasourceExample {
public static void main(String[] args) throws SQLException {
final AwsWrapperDataSource ds = new AwsWrapperDataSource();
ds.setJdbcUrl("jdbc:aws-wrapper:postgresql://database-pg.cluster-xyz.us-east-2.rds.amazonaws.com/postgres?options=-c%20statement_timeout=1000&wrapperLoggerLevel=all&wrapperPlugins=iam&user=jane_doe&iamRegion=us-east-2");
ds.setTargetDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
try (final Connection conn = ds.getConnection();
final Statement statement = conn.createStatement();
final ResultSet rs = statement.executeQuery("SELECT * from aurora_db_instance_identifier()")) {
if (rs.next()) {
System.out.println(rs.getString(1));
}
}
}
}
We can confirm the driver has a parsing issue in particular to ?options=-c%20statement_timeout=1000
. The driver is incorrectly truncating nested connection options when parsing connection URLs. We'll be issuing a fix that resolves this.
Our goal of the driver is to be drop-in compatible
with the native open-source drivers (PostgreSQL JDBC Driver, MySQL JDBC Driver, and MariaDB JDBC Driver) by aiming to minimize changes to only the connection string and working in conjunction with these drivers.
We'll provide an update here when the fix has been merged in.
I was having the same issue, thanks for confirming, our connection params were not getting applied, hope this could be fixed soon. Thanks @hsuamz
Thanks for the feedback @DhayanandBaskar.
For visibility, the fix has been merged into our main branch: https://github.com/awslabs/aws-advanced-jdbc-wrapper/pull/988
We do provide snapshot builds that will contain the fix. For more information, please refer to here: https://github.com/awslabs/aws-advanced-jdbc-wrapper/blob/main/docs/using-the-jdbc-driver/UsingTheJdbcDriver.md#using-a-snapshot-of-the-driver
As for an official release, we will be doing a release by the end of the month.
Any idea when this release is coming?
@smileatom , we'll be working on the release today and it will be made available this week.
Thank you!
Hi @smileatom ,
The fix is now available on the latest version of the AWS Advanced JDBC Wrapper Driver.
Thank you!
Hi @smileatom
I am having trouble reproducing this issue with the the latest version (2.3.7).
I am using a simple code snippet like the one below. The JDBC URL has the options
parameter set in the URL and includes encoded spaces.
public class DatasourceExample {
public static void main(String[] args) throws SQLException {
final AwsWrapperDataSource ds = new AwsWrapperDataSource();
ds.setJdbcUrl("jdbc:aws-wrapper:postgresql://database-pg.cluster-xyz.us-east-2.rds.amazonaws.com:5432/postgres?options=-c%20search_path=test,public,pg_catalog%20-c%20statement_timeout=90000&user=someUser&password=somePassword");
ds.setTargetDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
try (final Connection conn = ds.getConnection();
final Statement statement = conn.createStatement();
final ResultSet rs = statement.executeQuery("SELECT * from aurora_db_instance_identifier()")) {
if (rs.next()) {
System.out.println(rs.getString(1));
}
}
}
}
I have also debugged down to DataSourceConnectionProvider.java:175 where the returned Connection object is made from the target datasource object (PGSimpleDataSource
in this case). Here, I am seeing that the datasource object has properly set the options
parameter with the decoded expected value -c search_path=test,public,pg_catalog -c statement_timeout=90000
.
Can you confirm you are using the latest version (2.3.7) of the AWS Advanced JDBC Wrapper Driver and perhaps provide us a code snippet of how you are using the AWS JDBC Driver?
Thank you!
Hi @smileatom
I have configured a Spring Boot 3 application with the following application yaml file but unable to reproduce the issue.
spring:
datasource:
url: jdbc:aws-wrapper:postgresql://database-pg.cluster-xyz.us-east-2.rds.amazonaws.com:5432/postgres?options=-c%20search_path=test,public,pg_catalog%20-c%20statement_timeout=90000
username: username
password: password
driver-class-name: software.amazon.jdbc.Driver
Would you be able to share a sample snippet of your configuration, so that I continue investigation to reproduce the issue?
Thank you!
Sorry, an old version of the driver was still in the dependency tree. Retesting and will let you know.
This has been fixed. Thanks for your support!
Thanks for you confirming that the fix works! This issue will be closed now, but please feel free to reach out again if there are any other questions or concerns.
Describe the bug
The postgres sql driver supports connection options in the url. This driver does not. This is not a drop in replacement. Please remove the language from your marketing brochure.
Expected Behavior
driver connection options are supported in the datasource url
What plugins are used? What other connection properties were set?
IAM
Current Behavior
Unable to parse options....
Reproduction Steps
add ?options= and any driver option at the end of the datasource url.
Possible Solution
Support the same behavior as postgres driver.
Additional Information/Context
No response
The AWS Advanced JDBC Driver version used
any
JDK version used
any
Operating System and version
any