美文网首页
连接池(1课时)

连接池(1课时)

作者: wqjcarnation | 来源:发表于2020-03-16 10:09 被阅读0次

    dbcp连接池

        public static Connection getConnection() throws ClassNotFoundException, SQLException{
        BasicDataSource bSource = new BasicDataSource();
        String drivername = "com.mysql.jdbc.Driver";
        String url = "jdbc:mysql://localhost:3306/java24?characterEncoding=UTF-8&useUnicode=true";
        String username = "root";
        String password = "root";
        bSource.setDriverClassName(drivername);
        bSource.setUrl(url);
        bSource.setUsername(username);
        bSource.setPassword(password);
        return bSource.getConnection();
    
                     
    }

    相关文章

      网友评论

          本文标题:连接池(1课时)

          本文链接:https://www.haomeiwen.com/subject/ukvwehtx.html