babashka-sql-pods
babashka-sql-pods copied to clipboard
Socket support for mysql connections
The mysql connectorJ library does not include support for connections over unix sockets. https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-unix-socket.html
The documentation states that this support can be added via a third party lib and suggests https://kohlschutter.github.io/junixsocket/
It appears that this could be useful for other DBs as well (eg postrgesql).
Not sure exactly what the overhead would be, but if it's not too large would you be open to include the necessary parts of the junixsocket lib? Happy to work on a PR for this.
@mknoszlig Unix domain sockets are natively supported in JDK 17. Maybe we could just use GraalVM JDK 17 and use the native versions? I expect MySQL and Postgres will (soon?) add support for those.
/cc @lispyclouds
Yeah either we implement the SocketFactory classes for MySQL, Postgres etc using the JDK 17 Unix Socket facilities or wait for the JDBC drivers to have support for it for JDK 17. I would say waiting for the JDBC support could be better as I'm not sure what kind of jdbc url format would be used for this. If that's known we can support this now by implementing the factory classes for now and later drop it when JDBC supports it natively?
I'll see if i can come up with an implementation of SocketFactory based on the JDK 17 Unix Socket for mysql. Once JDBC supports it natively we can just drop that implementation again. For now i would use the same route as used in the junixsocket impementation: provide the socket factory as a jdbc parameter and having the path to the socket as a property.