Is the H2 automatic mixed mode the correct way to access a database on a network share from different clients?

StackOverflow https://stackoverflow.com/questions/18182518

سؤال

I have the same scenario as this one: H2 Database multiple connections. It's the classic "Microsoft Access database on network share" approach.

I have an application that should be installed on several clients within a LAN. During the installation, the user is asked to provide the database location on a network share.

I would like to avoid a separate database server/service installation. In the simplest case, the user just installs the application on 2 computers, both having access to a common network share (can be located on a 3rd computer/server).

Now it seems to me that the automatic mixed mode is what I am looking for, but I am not quite sure. I am mainly looking for confirmation of my understanding, since it isn't explicitly stated in the docs.

So, is the AUTO_SERVER mode the correct (intended/best) way to connect to an H2 database located on a network share from multiple clients running on different machines within the same LAN?

Or have I got this totally wrong and is this something I should not try at all?

Thanks for your time.

هل كانت مفيدة؟

نصائح أخرى

#Please find the full configuration: one should remember that if one has to run in server #and persistent mode with in spring boot application, the database file should be created #in advance. other wise create db file and place the location and start the h2 in server #mode

#Datasource Configuration
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:c:/data/studentdb;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=8043;AUTO_RECONNECT=TRUE;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;
spring.datasource.username=sa
spring.datasource.password=sa

#JPA Configuration
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect

#Connection Pool Configuration
spring.datasource.hikari.connection-timeout=20000
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=12
spring.datasource.hikari.idle-timeout=300000
spring.datasource.hikari.max-lifetime=1200000

#H2 Web Console
#spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
spring.h2.console.settings.trace=false
spring.h2.console.settings.web-allow-others=true
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top