Executing script file in h2 database

后端 未结 4 1332
一向
一向 2020-12-04 13:03

First of all I would like to say am new to h2 database. I need to execute a sql script file in h2 database. I have a script file test.sql and I want to execute this in h2 da

4条回答
  •  情歌与酒
    2020-12-04 13:47

    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"));
    

提交回复
热议问题