H2 TCP server 模式
所属分类 H2
浏览量 856
/home/admin/soft/h2
h2-1.4.195.jar
java -cp h2-1.4.195.jar org.h2.tools.Server -tcp -tcpPort 9300
nohup java -cp h2-1.4.195.jar org.h2.tools.Server -tcp -tcpPort 9300 &
driver=org.h2.Driver
url=jdbc:h2:tcp://127.0.0.1:9300//home/admin/soft/h2/data/myapp
jdbc:h2:tcp://127.0.0.1:9300//home/admin/soft/h2/data/myapp
/home/admin/soft/h2/data 目录下的 myapp 数据库
/home/admin/soft/h2/data/myapp.mv.db
jdbc:h2:tcp://127.0.0.1:9300/Users/dugang/work/test/soft/h2/data/db1/db1 报错
org.h2.jdbc.JdbcSQLException: A file path that is implicitly relative to the current working directory is not allowed in the database URL "jdbc:h2:tcp://127.0.0.1:9300/Users/dugang/work/test/soft/h2/data/db1/db1". Use an absolute path, ~/name, ./name, or the baseDir setting instead. [90011-195]
data/db1 目录不存在会自动创建
端口号之后用 // ,ok
jdbc:h2:tcp://127.0.0.1:9300//Users/dugang/work/test/soft/h2/data/db1/db1 报错
java -cp h2-1.4.195.jar org.h2.tools.Server -tcp -tcpPort 9300
TCP server running at tcp://192.168.0.10:9300 (only local connections)
if (service.getAllowOthers()) {
buff.append("others can connect");
} else {
buff.append("only local connections");
}
java -cp h2-1.4.195.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 9300
TCP server running at tcp://192.168.0.10:9300 (others can connect)
本地嵌入式和server模式 指向同一个数据库会报错
javax.servlet.ServletException: org.h2.jdbc.JdbcSQLException: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-195]
Database may be already in use: null.
Possible solutions: close all other connection(s);
use the server mode [90020-195]
java.lang.IllegalStateException: The file is locked: nio:/path/myapp.mv.db [1.4.195/7]
本地嵌入式模式
jdbc:h2:/home/admin/soft/h2/data/myapp
H2数据库使用
上一篇
下一篇
杭州历史文化及典故
影响商业的50本书第11到19本
MBA商业黑话
spring aop 代理对象生成
影响商业的50本书第20到29本
disruptor简介及核心概念