Fork me on GitHub
#sql
<
2022-12-02
>
valerauko04:12:07

what's the standard way in jdbc to set the database to use? i use hikari-cp for connection pooling and i was surprised that the mariadb adapter doesn't seem to support the databaseName option

seancorfield05:12:55

next.jdbc builds a JDBC URL (which includes the database name) and sets the jdbcUrl property in HikariCP in next.jdbc.connection/->pool @UAEH11THP

seancorfield05:12:05

Looks like hikari-cp supports that approach too via :jdbc-url?

seancorfield05:12:37

next.jdbc.connection/jdbc-url accepts a db-spec hash map (with :dbname etc) and will return a JDBC URL you could use with hikari-cp's :jdbc-url property.

valerauko09:12:17

is the url the only way to set the database?

seancorfield16:12:30

HikariCP itself has a databaseName property but I don't know whether it works for all drivers. Sounds like that's what you're running into with the hikari-cp wrapper and MariaDB?

valerauko03:12:47

yeah it seems to be... thanks