public static boolean createTableIfMissing ( Connection conn , String table , String [ ] definition , String postamble ) throws SQLException { if ( tableExists ( conn , table ) ) { return false ; } Statement stmt = conn . createStatement ( ) ; try { stmt . executeUpdate ( "create table " + table + "(" + StringUtil . join ( definition , ", " ) + ") " + postamble ) ; } finally { close ( stmt ) ; } log . info ( "Database table '" + table + "' created." ) ; return true ; }
Used to programatically create a database table . Does nothing if the table already exists .