2

これと同じシナリオがあります: H2 Database multiple connections。これは、従来の「ネットワーク共有上の Microsoft Access データベース」アプローチです。

LAN 内の複数のクライアントにインストールする必要があるアプリケーションがあります。インストール中に、ユーザーはネットワーク共有上のデータベースの場所を提供するよう求められます。

個別のデータベース サーバー/サービスのインストールは避けたいと考えています。最も単純なケースでは、ユーザーはアプリケーションを 2 台のコンピューターにインストールするだけで、どちらも共通のネットワーク共有にアクセスできます (3 台目のコンピューター/サーバーに配置できます)。

自動混合モードが私が探しているもののように思えますが、よくわかりません。ドキュメントには明示的に記載されていないため、主に私の理解の確認を求めています。

では、AUTO_SERVER モードは、同じ LAN 内の異なるマシンで実行されている複数のクライアントからネットワーク共有上にある H2 データベースに接続するための正しい (意図した/最良の) 方法ですか?

それとも、これは完全に間違っていて、これはまったく試してはならないことですか?

御時間ありがとうございます。

4

2 に答える 2

3

複数のオプションがあります。

于 2013-08-13T18:40:20.887 に答える
2
#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
于 2021-04-18T21:40:31.940 に答える