`
mengdejun
  • 浏览: 400332 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

java数据库连接池 V1.0

    博客分类:
  • Jav
阅读更多
package com.mdj.dmdatabase.test; 

import java.io.IOException; 
import java.sql.Connection; 
import java.sql.SQLException; 
import java.util.List; 
import java.util.Map; 

import com.mdj.dmdatabase.DmDriverManager.DatabaseManager; 
import com.mdj.dmdatabase.javabean.Guest; 

/** 
* @since <a href="http://blog.csdn.net/mak0000">Connectionpool 
*        EasyconnectionPool</a> 
* @author 武汉软件工程职业学院<br> 
*         孟德军<br> 
*         2009-01-01<br> 
*         封装了Dbutils工具<br> 
*         的部分细节 
* @version 2.0 
* 
*/ 
public class Test { 
    /** 
     * @see #manager DatabaseManager类的实例. 
     */ 
    private DatabaseManager manager; 
    /** 
     * @see #con <p bgcolor="#9acd32">java.sql.Connection con Connection实例</p> 
     */ 
    private Connection con = null; 

    public Test(String path) throws IOException, SQLException { 
         
     
        manager = DatabaseManager.getinstance(path); 
        // con = manager.getConnection(); 
        /** 
         * 此处书写代码. 查询数据无需用connection接收 
         */ 
        /*int a=manager.generalUpdate("insert into guestbook(author,title,ip,updatetime,content) values('王红梅','你过得怎么样','192.168.18.1','2009-01-04','你过得怎么样')"); 
        System.out.println(a);*/ 
        Map map = manager.mapexecuteQuery("select * from guestbook"); 
        for (int i = 0; i < map.size(); i++) { 
            System.out.println(map.get("author") + " " + map.get("title") + " " 
                    + map.get("ip") + map.get("updatetime") + " " 
                    + map.get("content")); 
        } 
        List list = manager.listexecuteQuery("select * from guestbook", 
                Guest.class); 
        Guest guestbook = null; 
        for (int i = 0; i < list.size(); i++) { 
            guestbook = (Guest) list.get(i); 
            System.out 
                    .println(guestbook.getAuthor() + "\t" 
                            + guestbook.getTitle() + "\t" + guestbook.getIp() 
                            + "\t" + guestbook.getUpdatetime() + "\t" 
                            + guestbook.getContent()); 
        } 
         
         
         manager.releaseConnection(con); manager.closeConnectionPool(); 
          

    } 
     
    public static void main(String[] args) { 

        String path = System.getProperty("user.dir") + "\\src\\sysconfig.xml"; 
        try { 
            new Test(path); 
        } catch (SQLException e) { 

        } catch (IOException e) { 
            e.printStackTrace(); 
        } 
    } 

} 

配置文件

<Context>
<Resource name="DMdatabase" type="javax.sql.DataSource"
   auth="Container" driverClassName="dm.jdbc.driver.DmDriver"
   url="jdbc:dm://localhost:12345/guest" username="SYSDBA"
   password="SYSDBA" maxActive="10" maxIdle="5" maxWait="6000" delaytime="10" logpath="..//poolserver.log" logsize="1024" />
</Context>
<!--
1.0使用的配置文件,已被以上内容替代.
<?xml version="1.0" encoding="UTF-8"?>
<driver xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<dbmsdriver name="华工达梦数据库系统">
<driverclass>dm.jdbc.driver.DmDriver</driverclass>
<url>jdbc:dm://localhost:12345/guest</url>
<username>SYSDBA</username>
<password>123456</password>
<maxconnection>8</maxconnection>
<minconnection>1</minconnection>
<maxwait>5</maxwait>
<logpath>..//poolserver.log</logpath>
</dbmsdriver>
</driver>
-->
<!--
<Context>
.........................................
</Context>
-->
<!--实例数据库
create database guest datafile 'd:\guest\guest.dbf' size 35;
set current database guest;
create table guestbook(author varchar(16) not null,title varchar(30),ip varchar(16),updatetime date,content text);
insert into guestbook(author,title,ip,updatetime,content)values('孟德军','达梦数据库测试','192.168.18.1','2009-01-05','示例数据库');
select * from guestbook;
-->

name="DMdatabase"
type="javax.sql.DataSource"
auth="Container"
driverClassName="dm.jdbc.driver.DmDriver"
url="jdbc:dm://localhost:12345/guest"
username="SYSDBA"
password="SYSDBA"
maxActive=4
maxIdle=2
maxWait=6000
delaytime=10
logpath="..//poolserver.log"
logsize=1024

 接口

java 数据库连接池(接口)2009-05-08 06:17 P.M.

package com.mdj.dmdatabase.develop; 

import java.io.PrintWriter; 
import java.io.Serializable; 
import java.io.UnsupportedEncodingException; 
import java.sql.Connection; 
import java.sql.ResultSet; 
import java.sql.SQLException; 
import java.util.List; 
import java.util.Map; 
import java.util.Vector; 

import javax.sql.DataSource; 

/** 
* @see Connectionpool EasyconnectionPool 
* @author 武汉软件工程职业学院<br> 
*         孟德军<br> 
*         2009-01-01<br> 
*         封装了Dbutils工具<br> 
*         的部分细节 
* @version 2.0 
*/ 
public interface DmDataSource extends DataSource, Serializable { 

    /** 
     * @see #resultset 存放数据库的表信息. 
     */ 
    ResultSet resultset = null; 
    /** 
     * @see #con 数据库连接 
     */ 
    Connection con = null; 
    /** 
     * @see #pool 连接池容器.可自行选择。 
     */ 
    Vector<Connection> pool = null; 
    /** 
     * @see #driverclass 数据库驱动类 
     */ 
    String driverclass = null; 
    /** 
     * @see #uername 数据库用户名 
     */ 
    String uername = null; 
    /** 
     * @see #password 数据库密码 
     */ 
    String password = null; 
    /** 
     * @see #url 连接数据库url 
     */ 
    String url = null; 
    /** 
     * @see #filepath 配置文件路径. 
     */ 
    String filepath = null; 
    /** 
     * @see #logpath 日志文件路径. 
     */ 
    String logpath = null; 
    /** 
     * @see #maxwaittime 允许等待时间 
     */ 
    int maxwaittime = 0; 
    /** 
     * @see #delaytime 延迟时间 
     */ 
    int delaytime = 0; 
    /** 
     * @see #maxconnection 最大连接 
     */ 
    int maxconnection = 0; 
    /** 
     * @see #minconnection 最小连接 
     */ 
    int minconnection = 0; 
    /** 
     * @see #poolsize 连接池大小. 
     */ 
    int poolsize = 0; 

    public void closeConnectionPool() throws SQLException; 
    /** 
     * @param username 数据库用户名<br>password 数据库密码 
     * @deprecated 建议使用getconnection() 
     * @see #getConnection() 参见 
     */ 
    public Connection getConnection(String username, String password) 
            throws SQLException; 
    /** 
     * @see #getConnection() 无用户名和密码,以在配置文件中配置。 
     */ 
    public Connection getConnection() throws SQLException; 

    public PrintWriter getLogWriter() throws SQLException; 

    public int getLoginTimeout() throws SQLException; 

    public void releaseConnection(Connection con); 

    public void setLogWriter(PrintWriter out) throws SQLException; 

    public void setLoginTimeout(int seconds) throws SQLException; 

    public Map mapexecuteQuery(String sql) throws SQLException; 

    public List listexecuteQuery(String sql, Class beanclass) 
            throws SQLException; 

    public ResultSet getTables(String catalog, String schemapattern, 
            String tablenamepattern, String[] types) throws SQLException; 

    public int getJDBCMajorVersion() throws SQLException; 

    public int generalUpdate(String sql) throws SQLException; 

    public ResultSet generalQuery(String sql) throws SQLException; 

    public String toChinese(String str, String oldcharsetName, 
            String newcharsetName) throws UnsupportedEncodingException; 
}
 

 

实现

package com.mdj.dmdatabase.DmDriverManager;

import java.io.File; 
import java.io.FileInputStream; 
import java.io.FileNotFoundException; 
import java.io.FileWriter; 
import java.io.IOException; 
import java.io.InputStream; 
import java.io.PrintWriter; 
import java.io.UnsupportedEncodingException; 
import java.sql.Connection; 
import java.sql.DatabaseMetaData; 
import java.sql.DriverManager; 
import java.sql.PreparedStatement; 
import java.sql.ResultSet; 
import java.sql.SQLException; 
import java.sql.Statement; 
import java.util.Date; 
import java.util.List; 
import java.util.Map; 
import java.util.Properties; 
import java.util.Timer; 
import java.util.TimerTask; 
import java.util.Vector;

import javax.xml.parsers.DocumentBuilder; 
import javax.xml.parsers.DocumentBuilderFactory; 
import javax.xml.parsers.ParserConfigurationException;

import org.apache.commons.dbutils.DbUtils; 
import org.apache.commons.dbutils.QueryRunner; 
import org.apache.commons.dbutils.handlers.BeanListHandler; 
import org.apache.commons.dbutils.handlers.MapListHandler; 
import org.w3c.dom.Document; 
import org.w3c.dom.Element; 
import org.w3c.dom.NodeList; 
import org.xml.sax.SAXException;

import com.mdj.dmdatabase.pool.Dmconnection;

/** 
* @see Connectionpool EasyconnectionPool 
* @author <hr><p bgcolor="#9acd32">武汉软件工程职业学院</p> 
*         孟德军<br> 
*         2009-01-03<br> 
*         封装了Dbutils<br> 
*         工具的部分细节 
* 
* @version 2.0 
*/ 
public class DatabaseManager extends Dmconnection {

    /** 
     * 
     */ 
    private static final long serialVersionUID = 1L; 
    /** 
     * @see #databasemetaData 数据源. 
     */ 
    private DatabaseMetaData databasemetaData; 
    /** 
     * @see #resultset 存放数据库的表信息. 
     */ 
    private ResultSet resultset = null; 
    /** 
     * @see #map 存放mapexecuteQuery查询结果 
     */ 
    private Map map = null; 
    /** 
     * @see #list 存放listexecuteQuery查询结果 
     */ 
    private List list = null; 
    /** 
     * @see #con 数据库连接 
     */ 
    private Connection con = null; 
    /** 
     * @see #pool 连接池容器.可自行选择。 
     */ 
    private Vector<Connection> pool = null; 
    /** 
     * @see #driverclass 数据库驱动类 
     */ 
    private String driverclass = "dm.jdbc.driver.DmDriver"; 
    /** 
     * @see #uername 数据库用户名 
     */ 
    private String username = "SYSDBA"; 
    /** 
     * @see #password 数据库密码 
     */ 
    private String password = "123456"; 
    /** 
     * @see #url 连接数据库url 
     */ 
    private String url = "jdbc:dm://localhost:12345/guest"; 
    /** 
     * @see #filepath 配置文件路径. 
     */ 
    private static String filepath = null; 
    /** 
     * @see #logpath 日志文件路径. 
     */ 
    private String logpath = "..//server.log"; 
    /** 
     * @see #maxwaittime 允许等待时间 
     */ 
    private int maxwaittime = 10; 
    /** 
     * @see #delaytime 延迟时间 
     */ 
    private int delaytime = 10; 
    /** 
     * @see #maxconnection 最大连接 
     */ 
    private int maxconnection = 10; 
    /** 
     * @see #minconnection 最小连接 
     */ 
    private int minconnection = 5; 
    /** 
     * @see #poolsize 连接池大小. 
     */ 
    private int poolsize = 10; 
    /** 
     * @see #manager 本类实例. 
     */ 
    private static DatabaseManager manager = null; 
    /** 
     * @see #timer 扫描连接池. 
     */ 
    private Timer timer; 
    private PrintWriter writer; 
    private boolean loading = false;

    /** 
     * @see #addConnection() 为连接池添加连接 
     * @throws ClassNotFoundException 
     */ 
    private DatabaseManager() { 
        try { 
            init(); 
            File file = new File(logpath); 
            writer = new PrintWriter(new FileWriter(file.getAbsolutePath(), 
                    true), true); 
            addConnection(); 
        } catch (IOException e) { 
            e.printStackTrace(); 
        }

    }

    private void init() { 
        if (loading == false) { 
            config(filepath); 
        } else {

            readconfig(filepath); 
        } 
        pool = new Vector<Connection>(maxconnection); 
        timer = new Timer(true); 
    }

    static public synchronized DatabaseManager getinstance(String path) { 
        // 必须先初始化变量filepath,然后在创建变量. 
        DatabaseManager.filepath = path; 
        if (manager == null) { 
            manager = new DatabaseManager(); 
        } 
        return manager; 
    }

    private void addConnection() { 
        serverlog("server start"); 
        for (int i = 0; i < maxconnection; i++) { 
            try { 
                Class.forName(driverclass); 
                DriverManager.setLogWriter(writer); 
                DriverManager.setLoginTimeout(maxwaittime); 
                con = DriverManager.getConnection(url, username, password); 
                pool.add(con);

            } catch (ClassNotFoundException e) { 
                // TODO Auto-generated catch block 
                serverlog(e.getMessage()); 
            } catch (SQLException e) { 
                // TODO Auto-generated catch block 
                serverlog(e.getMessage()); 
            } 
        } 
    }

    /** 
     * @see #releaseConnection(Connection) 释放连接,返还连接池. 
     * @return con 当前连接. 
     * 
     */ 
    public synchronized Connection getConnection() throws SQLException { 
        if (pool.size() > 0) { 
            con = pool.get(0); 
            pool.remove(0); 
            scaner(); 
            return con; 
        } else { 
            return con; 
        }

    }

    /** 
     * @see #releaseConnection(Connection) 释放连接,返还连接池. 
     * @return con 当前连接. 
     * 
     */ 
    public synchronized Connection getConnection(String username, 
            String password) { 
        if (pool.size() > 0) { 
            con = pool.get(0); 
            pool.remove(0); 
            return con; 
        } else { 
            return con; 
        }

    }

    public synchronized void releaseConnection(Connection con) { 
        pool.add(con);

    }

    /** 
     * @return 无返回值 
     * @see #closeConnectionPool() 关闭连接,清空连接池. 
     * @throws SQLException 
     */ 
    public void closeConnectionPool() throws SQLException { 
        for (int i = 0; i < pool.size(); i++) { 
            pool.get(i).close(); 
            pool.clear(); 
            timer.cancel(); 
        } 
    }

    /** 
     * @see #scaner()扫描连接池. 
     */ 
    private void scaner() { 
        TimerTask task = new TimerTask() { 
            @Override 
            public void run() { 
                // TODO Auto-generated method stub 
                if (manager.pool.size() < maxconnection) { 
                    while (manager.pool.size() < maxconnection) { 
                        addConnection(); 
                    } 
                } 
            }

        }; 
        timer.schedule(task, 10000, 10000); 
    }

    /** 
     * @see #config(String) 读取配置文件.<br> 
     *      初始化数据库连接数据. 
     * @since <hr>http://blog.csdn.net/mak0000 <a 
     *        href="http://blog.csdn.net/mak0000">更多信息</a> 
     * @throws path 
     *             为配置文件路径,文件路径错误会抛出FileNotFoundException异常 
     */ 
    /** 
     * @see #config(String) 读取配置文件. 
     */ 
    private void config(String path) { 
        loading = true; 
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
        try { 
            DocumentBuilder builder = factory.newDocumentBuilder(); 
            Document document = builder.parse(DatabaseManager.filepath); 
            NodeList nodelist = document.getElementsByTagName("dbmsdriver"); 
            for (int i = 0; i < nodelist.getLength(); i++) { 
                Element element = (Element) nodelist.item(i); 
                driverclass = element.getElementsByTagName("driverclass").item( 
                        0).getFirstChild().getNodeValue(); 
                url = element.getElementsByTagName("url").item(0) 
                        .getFirstChild().getNodeValue(); 
                username = element.getElementsByTagName("username").item(0) 
                        .getFirstChild().getNodeValue(); 
                password = element.getElementsByTagName("password").item(0) 
                        .getFirstChild().getNodeValue(); 
                maxconnection = Integer 
                        .parseInt(element.getElementsByTagName("maxconnection") 
                                .item(0).getFirstChild().getNodeValue()); 
                minconnection = Integer 
                        .parseInt(element.getElementsByTagName("minconnection") 
                                .item(0).getFirstChild().getNodeValue()); 
                logpath = element.getElementsByTagName("logpath").item(0) 
                        .getFirstChild().getNodeValue(); 
                maxwaittime = Integer.parseInt(element.getElementsByTagName( 
                        "maxwaittime").item(0).getFirstChild().getNodeValue()); 
                delaytime = Integer.parseInt(element.getElementsByTagName( 
                        "delaytime").item(0).getFirstChild().getNodeValue()); 
            } 
        } catch (ParserConfigurationException e) { 
            // TODO Auto-generated catch block 
            e.printStackTrace(); 
            serverlog(new Date() + ":\t" + e.getMessage() + "\n"); 
        } catch (SAXException e) { 
            e.printStackTrace(); 
            serverlog(new Date() + ":\t" + e.getMessage() + "\n"); 
        } catch (IOException e) { 
            e.printStackTrace(); 
            serverlog(new Date() + ":\t" + e.getMessage() + "\n"); 
        } 
    }

    /** 
     * @deprecated 该方法为候选方法. 
     * @param path 
     *            配置文件路径. 
     */ 
    public void readconfig(String path) { 
        loading = false; 
        Properties properties = new Properties(); 
        try { 
            InputStream in = new FileInputStream(DatabaseManager.filepath); 
            properties.load(in); 
            driverclass = properties.getProperty("driverclass"); 
            url = properties.getProperty("url"); 
            username = properties.getProperty("username"); 
            password = properties.getProperty("password"); 
            maxconnection = Integer.parseInt(properties 
                    .getProperty("maxconnection")); 
            minconnection = Integer.parseInt(properties 
                    .getProperty("minconnection")); 
            delaytime = Integer.parseInt(properties.getProperty("delaytime")); 
            logpath = properties.getProperty("logpath"); 
            in.close(); 
        } catch (FileNotFoundException e) {

            e.printStackTrace(); 
        } catch (IOException e) {

            e.printStackTrace(); 
        } 
    }

    /** 
     * @see #serverlog(String) 日志. 
     * @param msg 
     *            异常及日常信息. 
     * @since <a href="http://www.w3.org/xmlschema">建议将变量以配置文件形式存放,<br> 
     *        以方便使用,例如xml,properties<br> 
     *        文件.</a> 
     */

    private void serverlog(String msg) { 
        writer.println(new Date() + ":" + msg); 
        writer.close(); 
    }

    /** 
     * @see #setLogWriter(PrintWriter) set delay time 
     * @throws SQLException 
     */ 
    public void setLoginTimeout(int seconds) throws SQLException { 
        this.maxwaittime = seconds; 
    }

    /** 
     * @see #getLoginTimeout() get delay time. 
     * @throws SQLException 
     */ 
    public int getLoginTimeout() throws SQLException { 
        return maxwaittime; 
    }

    /** 
     * @see #setLogWriter(PrintWriter) set logwriter. 
     * @throws SQLException 
     */

    public void setLogWriter(PrintWriter out) throws SQLException { 
        this.writer = out; 
    }

    /** 
     * @see #getLogWriter() get logwriter 
     * @throws SQLException 
     */ 
    public PrintWriter getLogWriter() throws SQLException { 
        return writer; 
    }

    /** 
     * @see #listexecuteQuery(String, Class) put the var in list,list includes objects bean 
     * @since Book.class<br> 
     *        Book book=(Book)result.get(i);<br> 
     *        book.getid(); 
     */ 
    @Override 
    public List listexecuteQuery(String sql, Class beanclass) 
            throws SQLException { 
        con = getConnection(); 
        DbUtils.loadDriver(driverclass); 
        //build a queryrunner instance. 
        QueryRunner queryrunner = new QueryRunner(); 
        list = (List) queryrunner.query(con, sql, 
                new BeanListHandler(beanclass)); 
        releaseConnection(con); 
        return list;

    }

    /** 
     * @see #mapexecuteQuery(String) map形式存放数据.list includes map 
     */ 
    @Override 
    public Map mapexecuteQuery(String sql) throws SQLException { 
        // TODO Auto-generated method stub 
        con = getConnection(); 
        DbUtils.loadDriver(driverclass); 
        QueryRunner queryrunner = new QueryRunner(); 
        list = (List) queryrunner.query(con, sql, new MapListHandler()); 
        releaseConnection(con); 
        for (int i = 0; i < list.size(); i++) { 
            map = (Map) list.get(i); 
        } 
        return map; 
    }

    /** 
     * @see #getTables(String, String, String, String[])获取数据库表结构. 
     * @param catalog 
     *            ,schemaPattern,tableNamePattern,types 
     * 
     */ 
    public ResultSet getTables(String catalog, String schemaPattern, 
            String tableNamePattern, String[] types) throws SQLException { 
        con = getConnection(); 
        databasemetaData = con.getMetaData(); 
        resultset = databasemetaData.getTables(catalog, schemaPattern, 
                tableNamePattern, types); 
        releaseConnection(con); 
        return resultset; 
    }

    /** 
     * @see #getJDBCMajorVersion() jdbc主版本号. 
     */ 
    @Override 
    public int getJDBCMajorVersion() throws SQLException { 
        // TODO Auto-generated method stub 
        con = getConnection(); 
        databasemetaData = con.getMetaData(); 
        int version = databasemetaData.getJDBCMajorVersion(); 
        releaseConnection(con); 
        return version; 
    }

    /** 
     * @see #getJDBCMinorVersion() jdbc次版本号. 
     */ 
    @Override 
    public int getJDBCMinorVersion() throws SQLException { 
        // TODO Auto-generated method stub 
        con = getConnection(); 
        databasemetaData = con.getMetaData(); 
        int version = databasemetaData.getJDBCMinorVersion(); 
        releaseConnection(con); 
        return version; 
    }

    @Override 
    /* 
     * @see #getMaxConnections() 数据库支持的同时建立连接的对象数目. 
     */ 
    public int getMaxConnections() throws SQLException {

        con = getConnection(); 
        databasemetaData = con.getMetaData(); 
        int maxconnection = databasemetaData.getMaxConnections(); 
        releaseConnection(con); 
        return maxconnection; 
    }

    /** 
     * @see #getMaxStatements() 数据库支持同时打开statement的数目. 
     */ 
    @Override 
    public int getMaxStatements() throws SQLException { 
        // TODO Auto-generated method stub 
        con = getConnection(); 
        databasemetaData = con.getMetaData(); 
        int minconnection = databasemetaData.getMaxStatements(); 
        releaseConnection(con); 
        return minconnection; 
    }

    /** 
     * @see #generalUpdate(String) 更新. 
     */ 
    public int generalUpdate(String sql) { 
        int result = 0; 
        Statement statement; 
        try { 
            con = getConnection(); 
            statement = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, 
                    ResultSet.CONCUR_UPDATABLE); 
            result = statement.executeUpdate(sql); 
            statement.close(); 
            releaseConnection(con); 
        } catch (SQLException e) { 
            // TODO Auto-generated catch block 
            serverlog(e.getSQLState() + "\t" + e.getMessage()); 
        }

        return result;

    }

    public ResultSet generalQuery(String sql) { 
        ResultSet result = null; 
         
        Statement statement; 
        try { 
            con = getConnection(); 
            statement = con.createStatement(); 
            result = statement.executeQuery(sql); 
            result.close(); 
            statement.close(); 
            releaseConnection(con); 
        } catch (SQLException e) { 
            serverlog(e.getSQLState() + "\t" + e.getMessage()); 
        } 
        return result; 
    }

    public String toChinese(String str, String oldcharsetName, 
            String newcharsetName) { 
        String chinesestr = null; 
        if (str.equals(null) || str == "") { 
            chinesestr = ""; 
        } else { 
            try { 
                chinesestr = new String(str.getBytes(oldcharsetName), 
                        newcharsetName); 
            } catch (UnsupportedEncodingException e) { 
                serverlog("\t" + e.getMessage()); 
            } 
        } 
        return chinesestr; 
    }

}

 测试

 

分享到:
评论

相关推荐

    java jdbc帮助类 v1.0 自带连接池

    java jdbc帮助类 v1.0 自带连接池 boolean delete(java.lang.String sql) 删除单条记录的方法,适用于简单的sql语句 boolean delete(java.lang.String sql, java.util.Map&lt;java.lang.Integer,java.lang.Object&gt;...

    druid数据库连接池1.0.1版本

    druid数据库连接池1.0.1版本 已经用maven编译好jar包可以直接使用.你也可以去官方或git下载http://code.alibabatech.com/wiki/display/Druid/Home https://github.com/AlibabaTech/druid 然后自己编译

    【spring-boot-seckill分布式秒杀系统 v1.0】从0到1构建的java秒杀系统源码+安装说明

    spring-boot-seckill分布式秒杀系统是一个用SpringBoot开发的从0到1构建的分布式秒杀系统,项目案例基本成型,逐步完善中。...3、应用服务优化:Nginx最佳配置、Tomcat连接池优化、数据库配置优化、数据库连接池优化。

    用java写的一个数据库连接池

    自己开发的一个数据库连接池,包含代码,在oracle测试了一下,请各位对代码指正。 使用的方法如下: 1.在工程里面加入以下jar文件:mydatasource.jar,dom4j.jar,ojdbc14.jar 2.在工程目录任意位置放入连接池配置文件...

    新闻文章JSPCN中文网新闻发布系统v1.0-jspcnnews10.rar

    同时,系统还使用了数据库连接池技术,提高了数据处理的效率。总的来说,JSPCN中文网新闻发布系统v1.0_jspcnnews10.rar是一个功能齐全、技术先进、易于使用的新闻发布和管理工具,非常适合新闻网站或企业内部通讯...

    java-JDBC学习笔记(java连接数据库编程)

    我们所学习的均为jdbc2.0规范,jdbc1.0为直接连接,而jdbc2.0它有JNDI服务,在服务器启动时自动创建一个连接池,定义了一个DataSource接口,用其标准才能使用JDBC连接池

    开发相关jar包,nosql,jdom,netty,mysql,连接池

    activemq-all-5.5.1.jar,aopalliance-1.0.jar,aspectj-1.8.6.jar,aspectjweaver.jar,bson-3.0.2.jar,c3p0-0.9.1.jar,commons-beanutils-1.8.3.jar,commons-collections-3.2.1.jar,commons-dbcp-1.4.jar,commons-io-...

    JDiy开发框架与javaWeb建站平台v1.0

     通过JDiyLoadFilter过滤器配置,您可以将JDiy应用于javaWeb/javaEE开发环境中,JDiy内置多WEB应用程序统一管理程序,数据库连接池配置、自动销毁空闲的JDiy应用程序上下文等,在javaWeb应用中将大大的节省您的...

    在Tomcat服务器下使用连接池连接Oracle数据库

    下面介绍在Tomcat服务器下使用连接池来连接数据库的操作 一:修改web.xml文件: 代码如下: &lt;?xml version=”1.0″ encoding=”UTF-8″?&gt; &lt;web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance...

    Java洗衣店智能管理系统源码.zip

    数据库连接池:Druid 1.0 日志管理:SLF4J 1.7、Log4j 页面交互:Vue2.x Java洗衣店智能管理系统:实现对洗衣店的一体化管理,集前台衣物管理系统、会员卡管理系统、 财务报表系统等功能于一身,提高洗衣店的管理...

    Spring Acegi sample 基于数据库的DAO认证实现 c3p0做连接池技术

    acegi sample 基于数据库的DAO认证实现 Mysql的建表脚本在db目录下 为了减小体积,已经将WEB-INF\lib下的依赖包删除,请自行下载以下包,并拷贝至WEB-INF\lib下: spring-1.2.4.jar ... 用到c3p0做连接池技术

    Java Web应用详解.张丽(带详细书签).pdf

    动态网站篇深入讲解Servlet、JSP、JavaBean、JDBC数据库连接、数据库连接池等Java Web开发的核心技术。系统框架篇则是以架构设计的高度,讲解搭建网站的三大框架Struts、Hibernate、Sprin9及标签库。项目实战篇详细...

    JAVA上百实例源码以及开源项目源代码

    Java加密解密工具集 JCT v1.0源码包 5个目标文件 内容索引:JAVA源码,综合应用,JCT,加密解密  WDSsoft的一款免费源代码 JCT 1.0,它是一个Java加密解密常用工具包。 Java局域网通信——飞鸽传书源代码 28个目标文件...

    JAVA上百实例源码以及开源项目

    Java加密解密工具集 JCT v1.0源码包 5个目标文件 内容索引:JAVA源码,综合应用,JCT,加密解密  WDSsoft的一款免费源代码 JCT 1.0,它是一个Java加密解密常用工具包。 Java局域网通信——飞鸽传书源代码 28个目标文件...

    学生成绩管理系统 源码

    数据库连接池为apache组织下jakarta项目组开发的commons-dbcp 1.0 info.sql 数据库的表结构文件 其中表info_table1和info_table2有级联关系 guestbook.properties 属性文件,初始化了一些参数 mssqlserver.jar...

    基于Java开发的派单管理系统demo源码+项目说明+sql数据库(课程大作业).zip

    - 数据库连接池:Druid 1.0 - 日志管理:SLF4J 1.7、Log4j - 页面交互:Vue2.x - 缓存:redis 2.8 - 手机页面:weui 软件需求** - JDK1.8+ - MySQL5.5+ - Tomcat7.0+ - Maven3.0+ **本地部署** 下载源码 - 创建...

    Tomcat中配置数据源连接池

    maxAction="20" //连接池的最大数据库连接数。设为0表示无限制。 maxldle="10" //最大空闲数 设为0表示无限制 maxWait="-1" //最大连接等待时间。如果超时将接到异常。设-1表示 无限制。 /&gt; &lt;/Context&gt;

    java开源包4

    BoneCP 是一个高性能的开源java数据库连接池实现库。它的设计初衷就是为了提高数据库连接池的性能,根据某些测试数据发现,BoneCP是最快的连接池。BoneCP很小,只有四十几K(运行时需要slf4j和guava的支持,这二者加...

    commons-fileupload-1.0-beta-1.jar、commons-beanutils-1.8.3.jar

    Commons是Apache开放源代码组织中的一个Java子项目,该项目主要涉及一些开发中常用的模块,例如文件上传、命令行处理、数据库连接池、XML配置文件处理等。这些项目集合了来自世界各地软件工程师的心血,其性能、稳定...

    java开源包101

    BoneCP 是一个高性能的开源java数据库连接池实现库。它的设计初衷就是为了提高数据库连接池的性能,根据某些测试数据发现,BoneCP是最快的连接池。BoneCP很小,只有四十几K(运行时需要slf4j和guava的支持,这二者加...

Global site tag (gtag.js) - Google Analytics