Gurnard
Gurnard

Reputation: 1775

h2 cluster with file based database

I have set up an h2 cluster but cannot connect via the console or using a datasource all I get is this:

IO Exception: "java.io.IOException: The filename, directory name, or volume label syntax is incorrect"; "E:/baseDirDefinedInServerConnection/myDB,localhost:1112/myDB" [90031-176] 90031/90031 (Help)

I have configured 2 servers thus:

java -cp h2-1.3.167.jar org.h2.tools.Server -tcp -tcpPort 1111 -tcpAllowOthers -baseDir E:\myBaseDir 
at tcp://myIp:1111 (others can connect)

java -cp h2-1.3.167.jar org.h2.tools.Server -tcp -tcpPort 1112 -tcpAllowOthers -baseDir E:\myBaseDir\server
at tcp://myIp:1112 (others can connect)

So you see I have one database in a directory (this has been created) and another database in another directory. Both are up and running.

I have run the cluster tool thus:

java -cp h2-1.3.167.jar org.h2.tools.CreateCluster -urlSource jdbc:h2:tcp://localhost:1111/myDB -urlTarget jdbc:h2
:tcp://localhost:1112/myDB -user username -password pass -serverList localhost:1111,localhost:1112

And it all looks good. If I try to connect thorugh the console without the cluster list I get this message, which proves we are in clustered mode, which is good:

Clustering error - database currently runs in cluster mode, server list: 'localhost:1111,localhost:1112'" [

I have checked the permissions on the directories and all has read/write access. Yes this is a windows machine. Using H2 version: Bundle-Vendor: H2 Group Bundle-Version: 1.3.167

Any ideas what I might have done wrong? Thanks for reading.

Upvotes: 2

Views: 1798

Answers (1)

guai
guai

Reputation: 805

Guess you already found out that one should connect like this
jdbc:h2:tcp://localhost:1111,localhost:1112/myDB

Upvotes: 2

Related Questions