UNIX socket implementation for Java?

I realize that since UNIX sockets are platform-specific, there has to be some non-Java code involved. Specifically, we're interested in using JDBC to connect to a MySQL instance which only has UNIX domain sockets enabled.

It doesn't look like this is supported, but from what I've read it should be at least possible to write a SocketFactory for JDBC based on UNIX sockets if we can find a decent implementation of UNIX sockets for Java.

Has anyone tried this? Does anyone know of such an implementation?


Checkout the JUDS library. It is a Java Unix Domain Socket library...

https://github.com/mcfunley/juds


You could use junixsocket: https://github.com/kohlschutter/junixsocket

It already provides code for connecting to MySQL from Java (Connector/J) via Unix sockets.

One big advantage compared to other implementations is that junixsocket uses the standard Java Socket API.