Not respecting jdbc args?
See original GitHub issueWhich version and edition of Flyway are you using?
Flyway gradle plugin: 6.4.3
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Gradle plugin
Which database are you using (type & version)?
Postgres 12
Which operating system are you using?
MacOS
What did you do?
(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
I ran ./gradlew -Dflyway.configFiles=config.flyway flywayMigrate
with a config file that looks like :
flyway.url=jdbc:postgresql://127.0.0.1:5432/db_name?ssl=true&sslmode=verify-ca&sslrootcert=/path/to/server-ca.pem&sslkey=/path/to/client-key.pem&sslcert=/path/to/client-cert.pem
flyway.user=postgres
flyway.password=redacted
What did you expect to see?
A successful migration
What did you see instead?
SQL State : 28000
Error Code : 0
Message : FATAL: connection requires a valid client certificate
FATAL: connection requires a valid client certificate
I have confirmed that I can connect via psql or DataGrip with these files. With DataGrip I can copy paste that jdbc url and it works great. I’m not entirely convinced this is due to something in flyway, but I can’t seem to reproduce this outside of flyway. Any ideas is flyway messes with/doesn’t understand jdbc URLs?
Is there a better way to configure SSL with custom certs?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
What is the best approach using JDBC for parameterizing an ...
SELECT * FROM MYTABLE WHERE MYCOL in (?). And I want to parameterize the arguments to in. Is there a straightforward way to...
Read more >JDBC Driver Connection Parameter Reference
Specifies whether to allow underscores in account names. The JDBC Driver does not support underscores in URLs, which include the account name, so...
Read more >New behavior for parameters not setted with Ingres 2006 ...
New behavior for parameters not setted with Ingres 2006 JDBC driver “Expecting more arguments”. Behavior for processing the dynamic parameters changed ...
Read more >Using Prepared Statements - JDBC Basics - Oracle Help Center
No arguments are supplied to executeUpdate when they are used to execute updateSales and updateTotals ; both PreparedStatement objects already contain the SQL ......
Read more >Using named parameters in CALL statements in JDBC ... - IBM
You can use named parameters in either or both of the following places in a JDBC application: In the CALL statement. With named...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone struggling with this, @cyrbil is on point. I want to add a specific example of what worked for me applying his comment.
On Mac,
jdbc
driver. My original client key is.pem
and the certs are.crt
Above also works with the jdbc properties passed as params in the url, like @bit-void was doing
Just as information for the wanderers that could stumble on this issue:
To succesfully use
JDBC
arguments:root
andclient
) should be inX509+PEM
formatpem
andcrt
)PK8+DER
format.pk8
chmod 600 # or 400
)postgresql
,$HOME/.postgresql/{postgresql.crt,postgresql.pk8,root.crt}
should not exist) (not really necessary, but it avoids a headache)The error
connection requires a valid client certificate
, is returned by the server because no certificates was sent (you can see that usingJAVA_ARGS=-Djavax.net.debug=all
and observeNo available client authentication
, meaningJDBC
did not find a suitable certificate and will use anempty Certificate message
instead. The reason could be one of:CertificateRequest handshake message
(Either byType
,Signature Algorithm
, orCertificate Authority
). Use theJAVA_ARGS=-Djavax.net.debug=all
to see what the server is expecting andopenssl x509
to see what the certificate offers.