H2資料庫連線方式速查表

2021-06-01 21:07:38 字數 2227 閱讀 1009

轉至官方文件

topic

url format and examples

embedded (local) connection

jdbc:h2:[file:]

jdbc:h2:~/test

jdbc:h2:file:/data/sample

jdbc:h2:file:c:/data/sample (windows only)

in-memory (private)

jdbc:h2:mem:

in-memory (named)

jdbc:h2:mem:

jdbc:h2:mem:test_mem

server mode (remote connections) using tcp/ip

jdbc:h2:tcp://[:]/

jdbc:h2:tcp://localhost/~/test

jdbc:h2:tcp://dbserv:8084/~/sample jdbc:h2:tcp://localhost/mem:test

server mode (remote connections) using ssl/tls

jdbc:h2:ssl://[:]/

jdbc:h2:ssl://localhost:8085/~/sample;

using encrypted files

jdbc:h2:;cipher=[aes|xtea]

jdbc:h2:ssl://localhost/~/test;cipher=aes

jdbc:h2:file:~/secure;cipher=xtea

file locking methods

jdbc:h2:;file_lock=

jdbc:h2:file:~/private;cipher=xtea;file_lock=socket

only open if it already exists

jdbc:h2:;ifexists=true

jdbc:h2:file:~/sample;ifexists=true

don't close the database when the vm exits

jdbc:h2:;db_close_on_exit=false

execute sql on connection

jdbc:h2:;init=runscript from '~/create.sql'

jdbc:h2:file:~/sample;init=runscript from '~/create.sql'\\;runscript from '~/populate.sql'

user name and/or password

jdbc:h2:[;user=][;password=]

jdbc:h2:file:~/sample;user=sa;password=123

debug trace settings

jdbc:h2:;trace_level_file=

jdbc:h2:file:~/sample;trace_level_file=3

ignore unknown settings

jdbc:h2:;ignore_unknown_settings=true

custom file access mode

jdbc:h2:;access_mode_data=rws

database in a zip file

jdbc:h2:zip:!/

jdbc:h2:zip:~/db.zip!/test

compatibility mode

jdbc:h2:;mode=

jdbc:h2:~/test;mode=mysql

auto-reconnect

jdbc:h2:;auto_reconnect=true

jdbc:h2:tcp://localhost/~/test;auto_reconnect=true

automatic mixed mode

jdbc:h2:;auto_server=true

jdbc:h2:~/test;auto_server=true

page size

jdbc:h2:;page_size=512

changing other settings

jdbc:h2:;=[;=...]

jdbc:h2:file:~/sample;trace_level_system_out=3

連線各種資料庫方式速查表

1 oracle8 8i 9i資料庫 thin模式 class.forname oracle.jdbc.driver.oracledriver newinstance string url jdbcracle thinlocalhost 1521rcl orcl為資料庫的sid string use...

連線各種資料庫方式速查表

1 oracle8 8i 9i資料庫 thin模式 class.forname oracle.jdbc.driver.oracledriver newinstance string url jdbc oracle thin localhost 1521 orcl orcl為資料庫的sid strin...

連線各種資料庫方式速查表

1 oracle8 8i 9i資料庫 thin模式 class.forname oracle.jdbc.driver.oracl edriver newinstance string url jdbc oracle thin localhost 1521 orcl orcl為資料庫的sid stri...