How to execute SQL commands from standard input

36 views
Skip to first unread message

Martin Lichtin

unread,
Mar 28, 2018, 10:50:08 AM3/28/18
to H2 Database
Is there a way using either Shell or RunScript to execute SQL commands coming from standard input?

Pavel Goloborodko

unread,
Feb 15, 2020, 1:29:41 PM2/15/20
to H2 Database
This is how I do it:

cat script.sql | tail +6 | java -cp  ~/Downloads/h2/bin/h2-1.4.200.jar org.h2.tools.RunScript -url "jdbc:h2:~/dev/app/db/h2tmp;MAX_MEMORY_UNDO=0;MAX_OPERATION_MEMORY=0;WRITE_DELAY=0;LOG=0;LOCK_MODE=0;UNDO_LOG=0;REFERENTIAL_INTEGRITY=FALSE" -user sa -script '/dev/stdin'

(I need to skip a few top lines from the backup for some reason)
Reply all
Reply to author
Forward
0 new messages