package cn.com.startdima.util;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import org.activiti.engine.ProcessEngine;
  import org.activiti.engine.ProcessEngineConfiguration;
  import org.junit.Test;
  public class Demo {
  @Test
  public void createTable(){
  ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
  //连接数据库的配置
  processEngineConfiguration.setJdbcDriver("oracle.jdbc.OracleDriver");
  processEngineConfiguration.setJdbcUrl("jdbc:oracle:thin:@127.0.0.1:1521:orcl");
  processEngineConfiguration.setJdbcUsername("sysman");
  processEngineConfiguration.setJdbcPassword("Admin123");
  /**
  * public static final String DB_SCHEMA_UPDATE_FALSE = "false";//不能自动创建表,需手动创建表
  * public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop";//先删除表再创建表
  * public static final String DB_SCHEMA_UPDATE_TRUE = "true";//如果表不存在,自动创建表
  */
  processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
  //工作流的核心对象,processEngine对象
  ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
  System.out.println("processEngine:"+processEngine);
  }
  /**
  * 获取数据库连接
  * @return
  */
  @Test
  public void getConnection(){
  /** 声明Connection连接对象*/
  Connection conn = null;
  try{
  /** 使用Class.forName()方法自动创建这个驱动程序的实例且自动调用DriverManager来注册它*/
  Class.forName("oracle.jdbc.OracleDriver");
  /** 通过DriverManager的getConnection()方法获取数据库连接*/
  conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl",
  "sysman","Admin123");
  System.out.println(conn+"-------------------");
  }catch(Exception ex){
  ex.printStackTrace();
  }
  }
  }