public Connection getConnection() throws Exception {
//IO流读取配置文件
FileInputStream is =
new FileInputStream("src/druid.properties");
//创建一个Properties集合类,加载配置文件的IO流内容
Properties pros = new Properties();
pros.load(is);
//将加载过的配置文件载入到德鲁伊数据库连接池中
DataSource source = DruidDataSourceFactory.createDataSource(pros);
//从数据库连接池中建立连接
Connection conn = source.getConnection();
return conn;
}