2021年3月4日星期四

Java H2 Mixed mode (embedded and server) external connection

I am trying to convert my existing embedded H2 database and enable external connections to it. Currently my properties are

spring.datasource.url=jdbc:h2:file:./db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9090  spring.datasource.driverClassName=org.h2.Driver  spring.jpa.database-platform=org.hibernate.dialect.H2Dialect    spring.h2.console.enabled=true  spring.h2.console.path=/h2  spring.h2.console.settings.web-allow-others=true  server.ssl.enabled=true  server.ssl.key-store-password=####  server.ssl.key-password=###  server.ssl.key-store-type=JKS  etc  

For a local connection to my db in this mode I seem to be able to connect to "jdbc:h2:file:./db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9090" through my intellej IDE.

If this database is hosted on a external server how do i connect to it? I have tried putting the hostname into this URL such as at jdbc:h2:file:123.456.789.10/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9090 But it is unable to connect.

https://stackoverflow.com/questions/66475276/java-h2-mixed-mode-embedded-and-server-external-connection March 04, 2021 at 08:43PM

没有评论:

发表评论