Here you can find the source of createTable(String dbFile, String tableName, String tableDefinition)
public static void createTable(String dbFile, String tableName, String tableDefinition) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.HashMap; import java.util.Map; public class Main { private final static Map<String, Connection> connections = new HashMap<>(); public static void createTable(String dbFile, String tableName, String tableDefinition) throws SQLException { checkConnection(dbFile);//from ww w .j a v a 2 s . com Connection connection = getConnection(dbFile); Statement statement = connection.createStatement(); String sql = "create table " + tableName + " (" + tableDefinition + ")"; System.out.println(sql); statement.executeUpdate(sql); statement.close(); } private static void checkConnection(String dbFile) { try { Connection connection = connections.get(dbFile); if (connection.isClosed()) initializeConnection(dbFile); } catch (SQLException e) { throw new RuntimeException(e); } } public static Connection getConnection(String dbFile) { checkConnection(dbFile); return connections.get(dbFile); } public synchronized static void initializeConnection(String dbFile) { try { Connection connection = DriverManager.getConnection(getDbURL(dbFile)); connections.put(dbFile, connection); } catch (Exception ex) { throw new RuntimeException(ex); } } public static String getDbURL(String dbFile) { return "jdbc:h2:" + dbFile + ";MODE=MySQL;FILE_LOCK=NO"; } }