How to run H2 database in server mode?

前端 未结 5 403
谎友^
谎友^ 2020-12-02 11:46

How to start H2 database in server mode. I need to start it from my application.I tried the following code:

server = Server.createTcpServer().start();
         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 11:47

    I was getting this error when trying to start H2.
    See also http://h2database.com/javadoc/org/h2/tools/Server.html

    Exception in thread "main" org.h2.jdbc.JdbcSQLException: Feature not supported: "-~webAllowOthers" [50100-197]

    So I followed these steps:

    1. make dir mkdir h2db this directory will have your db files.
    2. Hit this command : java -cp bin/h2-1.4.197.jar org.h2.tools.Server -web -webAllowOthers -tcp -tcpAllowOthers -baseDir /home/manoj/dev/h2/h2db_6.0
      this command will start h2
    3. If you want to run h2 in backend then open vi h2.sh and paste this command in this: nohup java -cp bin/h2-1.4.197.jar org.h2.tools.Server -web -webAllowOthers -tcp -tcpAllowOthers -baseDir /home/manoj/dev/h2/h2db_6.0/ &
    4. Now run ./bin.h2.sh.

提交回复
热议问题