C3P0
jar包准备 获取数据库连接对象Connection的方法一 public void test ( ) throws Exception { ComboPooledDataSource cpds = new ComboPooledDataSource ( ) ; cpds . setDriverClass ( "com.mysql.cj.jdbc.Driver" ) ; cpds . setUser ( "root" ) ; cpds . setPassword ( "root" ) ; cpds . setJdbcUrl ( "jdbc:mysql://localhost:3306/test?serverTimezone=UTC" ) ; cpds . setInitialPoolSize ( 10 ) ; Connection conn = cpds . getConnection ( ) ; System . out . println ( conn ) ; } 获取数据库连接对象Connection的方法二 配置c3p0-config.xml < c3p0 - config > < named - config name = "helloc3p0" > < ! -- 提供 4 个基本信息 -- > < property name = "driverClass" > com