private void closeConnection() {
   try {
     if (statement != null) statement.close();
     if (connection != null) {
       JDBCExceptionReporter.logWarnings(connection.getWarnings());
       connection.clearWarnings();
       connectionProvider.closeConnection(connection);
       connectionProvider.close();
     }
   } catch (Exception e) {
     System.err.println("Could not close connection");
     e.printStackTrace();
   }
 }
 public static void main(String[] args) {
   try {
     if ((args != null) && (args.length == 1) && ("create".equalsIgnoreCase(args[0]))) {
       new IdentitySchema(IdentitySessionFactory.createConfiguration()).createSchema();
     } else if ((args != null) && (args.length == 1) && ("drop".equalsIgnoreCase(args[0]))) {
       new IdentitySchema(IdentitySessionFactory.createConfiguration()).dropSchema();
     } else if ((args != null) && (args.length == 1) && ("clean".equalsIgnoreCase(args[0]))) {
       new IdentitySchema(IdentitySessionFactory.createConfiguration()).cleanSchema();
     } else if ((args != null) && (args.length == 3) && ("scripts".equalsIgnoreCase(args[0]))) {
       new IdentitySchema(IdentitySessionFactory.createConfiguration())
           .saveSqlScripts(args[1], args[2]);
     } else {
       System.err.println("syntax: JbpmSchema create");
       System.err.println("syntax: JbpmSchema drop");
       System.err.println("syntax: JbpmSchema clean");
       System.err.println("syntax: JbpmSchema scripts <dir> <prefix>");
     }
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException(e);
   }
 }