Reputation: 41
I'm new to h2, but I read a lot of documentation, I successfully created embeded H2 mem or file database.
But I'm still not able to use server mode or mixed mode :
I launch my Web server and tcp server like this :
java -jar h2-1.4.196.jar -web -webAllowOthers -tcp -tcpAllowOthers -browser -tcpPort 9092
Trying server mode :
I create file database like this :
I open H2 console and enter following :
Database is created, and I see a lock file
In my java application
--> When I launch my java application properties file, it stays sticked at the phase of datasource creation. I tried to change url: jdbc:h2:tcp://localhost:9092/~/maBaseH2FichierTCP to jdbc:h2:tcp://localhost/~/maBaseH2FichierTCP, but no effect.
Trying mixed mode :
In H2 console, I created jdbc:h2:C:/data/maBaseFichierAutoServeur;AUTO_SERVER=TRUE
In java, url: jdbc:h2:tcp://192.168.1.152:55000/file:c:/data/maBaseFichierAutoServeur;AUTO_SERVER=TRUE
--> Behaviour is the same, application start, but when at datasource creation, it waits, and nothing more happen ...
Does someone take has a idea to make one of orther server mode work ?
Upvotes: 0
Views: 437
Reputation: 41
I solved this first problem : It was caused by a incompatibility between h2 version of h2 console, and my h2 client in application. 1.4.196 vs 1.4.192; when debuging, we can see an exception is launched, but nothing is writen on debug or even trace I think, and programme try to execute a rollback on a connection. It ended in a infinite loop here, even if I don't understand why. When changing version, I can connect my remote base.
Howerver now, when application update the database, the updated data cannot been seen in h2 console. Does someone know why ?
Upvotes: 0