Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

ProxySQL Fails with JDBC Parameter CreateDatabaseIfNotExist

12 views
Skip to first unread message

Hans Wunsch

unread,
Nov 13, 2024, 12:34:46 AM11/13/24
to proxysql
Hello Proxysql Community members,

Does anybody have experience using the createDatabaseIfNotExist JDBC parameter with proxysql?

I'm trying to use proxysql in front of our application database.  When the springboot app boots it connects to the database with the following JDBC URL:

jdbc:mysql://mysql.example.com:3306/accounts?createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true&useSSL=false

This should create the database if it doesn't already exist.  And when connnecting directly to the backend db or through an haproxy server,  works as intended..

When connecting via proxysql, an `Unknown Dataabse` error is returned.   

Hoping someone can provide some insight on how to get it working.

Thanks,
Hans.

René Cannaò

unread,
Nov 13, 2024, 12:40:59 AM11/13/24
to Hans Wunsch, proxysql
Hi Hans,

ProxySQL expects the database to exist.

I assume JDBC doesn't check if the database exists, but it relies on receiving an error and then creating the database in case of error.
If my assumption is correct, to make it works with ProxySQL , JDBC should first check if the database exists.

Thus, that JDBC option can't work with ProxySQL.

The longer answer is that schemaname is part of ProxySQL routing algorithm: thus it really makes no sense to have routing to a server where the schema doesn't exist.

Create the schema beforehand.

Thanks,
René

--
You received this message because you are subscribed to the Google Groups "proxysql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/proxysql/76d89ae1-f3ae-4dde-b70e-b2bf75201d21n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages