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

How can I describe a table in Oracle without using the DESCRIBE command?

You’re looking for USER_TAB_COLUMNS – all the columns, and their descriptions in the schema the query is executed in – or ALL_TAB_COLUMNS – the same except for all tables that user has permission to view. A typical query might be: select * from user_tab_columns where table_name=”MY_TABLE” order by column_id column_id is the “order” of the … Read more

How to Execute SQL Script File in Java?

There is great way of executing SQL scripts from Java without reading them yourself as long as you don’t mind having a dependency on Ant. In my opinion such a dependency is very well justified in your case. Here is sample code, where SQLExec class lives in ant.jar: private void executeSql(String sqlFilePath) { final class … Read more