Unix socket connection to MySql with Java to avoid JDBC's TCP/IP overhead?

Ollie Glass picture Ollie Glass · Sep 22, 2010 · Viewed 7.5k times · Source

Is it possible to make a Unix socket connection to MySql with Java to avoid JDBC's TCP/IP overhead?

Does anyone know a library (or a few libraries, perhaps) that makes this possible?

Answer

Peter Tillemans picture Peter Tillemans · Sep 22, 2010

Also the mySQL JDBC driver has been polished over a long period and has several optimization tweaks , like caching of metadata. I would be surprised that the JDBC developers would have left a lot of TCP/IP overhead in the driver.

Going over JNI to the C based implementation would probably cost more in jumping to native code than can be gained from reduced TCP/IP overhead.

If you really want to cut out the TCP/IP overhead you might consider using an embedded database like sqlite, derby or hypersonic.