-
Notifications
You must be signed in to change notification settings - Fork 0
/
h2db.groovy
executable file
·35 lines (34 loc) · 1.4 KB
/
h2db.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env groovy
//#Run the h2 sq ltool.
@Grab('com.h2database:h2:2.2.224') import org.h2.Driver
import org.h2.tools.Shell
args = new String[8]
args[0]="-url"
//args[1]="jdbc:h2:file:/tmp/dbh2/testdb;FILE_LOCK=NO;IFEXISTS=TRUE;DATABASE_TO_UPPER=FALSE;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1;INIT=SET SCHEMA public;"
//args[1]="jdbc:h2:file:/tmp/dbh2/testdb;MODE=MYSQL"
//args[1]="jdbc:h2:file:./db/test;MODE=HSQLDB"
//args[1]="jdbc:h2:file:/tmp/h2/dataSource;DATABASE_TO_UPPER=FALSE;MODE=MYSQL;FILE_LOCK=NO;DB_CLOSE_ON_EXIT=FALSE"
//Note: both clients must use AUTO_SERVER=TRUE to share the database.
//args[1]="jdbc:h2:file:/tmp/h2/dataSource;DATABASE_TO_UPPER=FALSE;MODE=HSQLDB;AUTO_SERVER=TRUE"
//args[1]="jdbc:h2:file:/tmp/h2/dataSource;DATABASE_TO_UPPER=FALSE;MODE=MYSQL;AUTO_SERVER=TRUE"
//args[1]="jdbc:h2:mem:dataSource;DATABASE_TO_UPPER=FALSE;MODE=strict"
//args[1]="jdbc:h2:mem:dataSource;DATABASE_TO_UPPER=FALSE;MODE=LEGACY"
args[1]="jdbc:h2:file:/tmp/h2/dataSource;DATABASE_TO_UPPER=FALSE;MODE=LEGACY;AUTO_SERVER=TRUE"
args[2]="-user"
args[3]=""
args[4]="-password"
args[5]=""
args[6]="-driver"
args[7]="org.h2.Driver"
org.h2.tools.Shell.main(args)
// Commands:
//
// show tables;
// show columns from ...
// select current_schema;
// select current_catalog;
// @tables;
// @tables null null ...;
// @info
// select * from information_schema.tables;
// RUNSCRIPT FROM 'create_schema.sql'