How to run H2 database script from command line

http://stackoverflow.com/questions/10675768/executing-script-file-in-h2-database

 

You can use the RUNSCRIPT SQL statement:

RUNSCRIPT FROM 'test.sql'

or you can use the RunScript standalone / command line tool:

java -cp h2*.jar org.h2.tools.RunScript -url jdbc:h2:~/test -script test.sql

You can also use the RunScript tool within an application:

RunScript.execute(conn, new FileReader("test.sql"));
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s