Search code examples
javawindowsjdbcmariadbnamed-pipes

Can't connect to MariaDB by named pipe with java client connector


Spent about two days combining/testing protocols, parameters with no luck. Seems that java client connector is buggy, but maybe I miss something.

  1. Windows (10, but I think there is no difference)
  2. mariadb-java-client-3.1.1.jar (https://mariadb.com/downloads/connectors/connectors-data-access/java8-connector/)
  3. Trying connect DBeaver/Openfire that uses java client (Heidi uses .dll and named pipe there works ok, as the mariadb ODBC works ok too [if not writing pipe name to corresponding input field]) a) for DBeaver with many types of url (needed to copy MariaDB driver as "MariaDB Named Pipe" for example and edit url) b) for Openfire jdbc...

Tried a lot of combinations, a lot.

jdbc:mariadb://localhost/?pipe=MySQL
jdbc:mariadb://localhost/?pipe=\\.\pipe\MySQL
jdbc:mariadb://localhost/?pipe=\\\\.\\pipe\\MySQL
jdbc:mariadb://localhost/?pipe=//./pipe/MySQL
jdbc:mysql://localhost/?protocol=pipe&permitMysqlScheme
  • parameters pipe/pipeName/socket/socketName/socketPath
  • parameters alone and in combinations
  • socketFactory as was in mysql - I don't know mariadb factory and mysql factory didn't accepted
  • protocol=pipe in parameters part (after "?") and in host part localhost=(protocol=pipe)
  • with "localhost", "." as host and no host ":///"

Nothing helped. Just "hostname must be set" in most situations and "the address can't be null" when "pipe=something" (pipe=MySQL, pipe=\.\pipe\MySQL etc, not "pipe=")

When connecting to the MariaDB by mysql java connector - then all is ok, it's enough to type "jdbc:mysql:///?protocol=pipe" in url and all works fine. But mariadb java connector...

Any suggestions?


Solution

  • To succesful connect through pipe I do:

    1. use/connect mariadb java client, for example mariadb-java-client-3.1.2.jar
    2. use/connect jna - without this it will never work, for example jna-5.13.0.jar
    3. connection properties: Driver: org.mariadb.jdbc.Driver ServerURL: jdbc:mariadb:///yourdatabase?pipe=MySQL