A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

虽然运行的结果最后也出现了,但是出现了下面的一些异常信息

2018-8-6 9:12:28 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
2018-8-6 9:12:28 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.2-pre1 [built 27-May-2010 01:00:49 -0400; debug? true; trace: 10]
2018-8-6 9:12:28 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 5, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge0yv9x3js4x6o78mub|79de256f, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0yv9x3js4x6o78mub|79de256f, idleConnectionTestPeriod -> 0, initialPoolSize -> 20, jdbcUrl -> jdbc:mysql://localhost:3306/student, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 50, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 2, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, statementDestroyerNumActiveThreads -> -1, statementDestroyerNumConnectionsInUseAllUsers -> -1, statementDestroyerNumConnectionsInUseDefaultUser -> -1, statementDestroyerNumConnectionsWithDeferredDestroyStatementsAllUsers -> -1, statementDestroyerNumConnectionsWithDeferredDestroyStatementsDefaultUser -> -1, statementDestroyerNumDeferredDestroyStatementsAllUsers -> -1, statementDestroyerNumDeferredDestroyStatementsDefaultUser -> -1, statementDestroyerNumIdleThreads -> -1, statementDestroyerNumTasksPending -> -1, statementDestroyerNumThreads -> -1, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
com.mchange.v2.c3p0.impl.NewProxyConnection@26659db7


代码如下:
[mw_shl_code=applescript,true]package cn.itcast_01;

import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.SQLException;

import org.junit.Test;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class Demo1 {
        @Test
        public void fun() throws PropertyVetoException, SQLException {
                // 建立连接池对象
                ComboPooledDataSource dataBase = null;

                dataBase = new ComboPooledDataSource();

                // 设置四大参数
       
                        dataBase.setDriverClass("com.mysql.jdbc.Driver");
               
                dataBase.setJdbcUrl("jdbc:mysql://localhost:3306/student");
                dataBase.setUser("root");
                dataBase.setPassword("123");

                // 设置池参数
                dataBase.setAcquireIncrement(5);
                dataBase.setInitialPoolSize(20);
                dataBase.setMaxPoolSize(50);
                dataBase.setMinPoolSize(2);
                // 得到连接
                Connection con = dataBase.getConnection();
                System.out.println(con);
                con.close();
        }
}

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马