spring-cloud-aws
spring-cloud-aws copied to clipboard
Add support for passing query parameters to JDBC url
In spring boot I configure database name to have dbname?rewriteBatchedStatements=true on the end. This should append rewriteBatchedStatements=true after the database name for the postgres connection URL. When I debug it I see the ? being converted to %3F at runtime. I have tried using %3F in the database name and still get the error.
cloud.aws.rds.INSTANCE.databaseName=dbname?rewriteBatchedStatements=true
Gives:
2020-09-18 16:32:57.152 ERROR (main) [org.apache.juli.logging.DirectJDKLog] Unable to create initial connections of pool.
org.postgresql.util.PSQLException: FATAL: database "dbname?rewriteBatchedStatements=true" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2510)
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2622)
at org.postgresql.core.v3.QueryExecutorImpl.
Is there another way to configure rewriteBatchedStatements?
Thanks @jamesgustard for reporting. It's a bug and I couldn't find a way to pass today query parameters to JDBC url. We will work on it.
Thanks , according to the postgres docs , "These properties may be specified in either the connection URL or an additional Properties object parameter to DriverManager.getConnection. The following examples illustrate the use of both methods to establish a SSL connection."
I was trying to configure the properties sent to the connection but could not find a away to access them. Being able to configure the properties would enable one to set rewriteBatchedStatements without changing the URL, this could be a possible approach.
https://jdbc.postgresql.org/documentation/94/connect.html