Connection connection = null;
JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(null);
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmContext.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
SessionFactoryImpl sessionFactory = (SessionFactoryImpl) dbPersistenceServiceFactory.getSessionFactory();
ConnectionProvider connectionProvider = sessionFactory.getConnectionProvider();
connection = connectionProvider.getConnection();
Statement statement = connection.createStatement();
log("shutting down database");
statement.executeUpdate("SHUTDOWN");
connection.close();