zoukankan      html  css  js  c++  java
  • 连接池

    常见连接池Tomcat-dbcp、dbcp、c3p0、druid

    可以用数据源(java.sql.DataSource)管理连接池

    Tomcat-dbcp:

    a.类似jndi 在 context.xml中配置数据库

    <Environment name="student" value="jndiValue" type="java.lang.String"/>
        
           <Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource" 
                     maxActive="400" maxIdle="20" maxWait="5000" 
                     username="root" password="123456" driverClassName="com.mysql.jdbc.Driver" 
                     url="jdbc:mysql://localhost:3306/test?autoReconnect=true"/>  

    b.项目中web.xml中配置

    <resource-ref>
            <res-ref-name>student</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
  • 相关阅读:
    装饰复杂函数
    装饰器01
    闭包
    函数的嵌套定义
    名称空间
    函数的嵌套调用
    函数的对象
    形参
    实参
    形参与实参
  • 原文地址:https://www.cnblogs.com/mzdljgz/p/11062760.html
Copyright © 2011-2022 走看看