Here you can find the source of createTable(DataSource ds, String tableName)
public static void createTable(DataSource ds, String tableName)
//package com.java2s; import javax.sql.DataSource; import java.sql.Connection; public class Main { private static final String ID_COLUMN_NAME = "id"; private static final String VALUE_COLUMN_NAME = "a"; public static void createTable(DataSource ds, String tableName) { try (Connection conn = ds.getConnection()) { conn.createStatement().executeUpdate(String.format("CREATE TABLE %s (%s INT, %s VARCHAR(255))", tableName, ID_COLUMN_NAME, VALUE_COLUMN_NAME)); } catch (Exception sqle) { throw new RuntimeException("can't create table", sqle); }/*from w w w . j a va2s . co m*/ } }