Stefan
Stefan

Reputation: 12380

Is it possible to connect MySQL Workbench to H2 in memory database?

I am running an H2 in memory database with following connection url:

"jdbc:h2:mem:my_database;DB_CLOSE_DELAY=-1;MODE=MySQL"

H2 allows to start servers to be able to establish alternative connections to the in memory database:

                sysLog.info("Creating web server.");
                String[] webServerSettings = new String[]{"-webPort","8085","-webAllowOthers"};
                webServer = Server.createWebServer(webServerSettings);
                webServer.start();

                sysLog.info("Creating tcp server.");
                String[] tcpServerSettings = new String[]{"-tcpPort","9095","-tcpAllowOthers"};
                tcpServer = Server.createTcpServer(tcpServerSettings);
                tcpServer.start();

http://www.h2database.com/javadoc/org/h2/tools/Server.html

After creating a server I am able to show a web console and browse the database content. However, I would prefer to use MySQL Workbench for that purpose and I did not yet succeed to connect MySQL Workbench to such an H2 server.

If I use the connection settings localhost:8085 or localhost:9095 in MySQL Workbench following error occurs:

Lost connection to MySQL server at 'waiting for initial communication packet', system error:10060

My Questions: Is it possible to use MySQL Workbench (or Navicat for MySQL) to connecto to an H2 database at all? If yes, what are the right settings?

(Alternatives to MySQL Workbench are given here: Frontend tool to manage H2 database)

Upvotes: 3

Views: 6765

Answers (1)

Usagi Miyamoto
Usagi Miyamoto

Reputation: 6329

No, H2 implements PostgreSQL protocols, as stated at the ODBC Driver section of the documentation.

Upvotes: 2

Related Questions