npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

db-connection-pool

v1.2.1

Published

Oracle/MySQL/PostgreSQL 데이터베이스 Pool

Downloads

14

Readme

db-connection-pool

db-connection-pool 라이브러리는 Mysql 사용자와 Oracle 사용자 및 PostgreSQL 사용자를 위해 만들었습니다.

요약

해당 라이브러리는 MySQL과 PostgreSQL 및 Oracle의 사용을 여러대 사용하거나, 여러 서버에서 같은 설정파일을 이용하여 데이터베이스를 관리 및 접근할 때 유용할 것입니다.

설정파일을 통해 데이터베이스를 만들고, 데이터베이스의 접근은 사전에 만들어 놓은 Pool 객체에서 Connection 객체를 통해 접근하실 수 있습니다.

아래 설정을 통해 데이터베이스를 쉽게 접근하세요.

Installation

From npm:

npm install --save db-connection-pool

Usage

Importing

이 라이브러리는 CJS 형태로 제공되며 자바스크립트와 타입스크립트 프로젝트 모두에서 사용할 수 있습니다.

아래는 CJS 형태에서 임포트를 하기 위한 방법입니다.

const { dbInstance } = require("db-connection-pool");

Examples

먼저 데이터베이스의 설정 파일을 정의합니다.

[postgresql1]
host=localhost
user=postgres
password=root
idleTimeoutMillis=30000
connectionTimeoutMillis=2000
max=20

[mysql1]
host=localhost
user=root
password=root
port=3306
database=test
connectionLimit=4

[oracle1]
user=root
password=root
connectString=localhost/XE
poolAlias=cdr1
poolIncrement=0
poolMax=4
poolMin=4
poolPingInterval=30

그리고 해당 라이브러리를 사용하여 편리하게 데이터베이스를 접근할 수 있습니다.

const { dbInstance } = require("db-connection-pool");

const options = {
    type: "INI" /** 데이터베이스 설정 파일 확장자 */,
    path: "../db.ini" /** 데이터베이스 설정파일 경로 */,
    autoRepair: true /** 데이터베이스 접속 및 쿼리 진행 중 오류 발생 시 자동 리페어 기능 */,
    attemptRepairCount: 5 /** 자동리페어 기능을 수행하는 횟수 */,
    conCurrentSQL: 20 /** 하나의 데이터베이스를 동시 수행할 수 있는 최대 사용자 수 */,
    waitingForDB: 1000 /** 자동리페어 기능을 수행할 떄 기다리는 시간 */,
};

async function hello() {
    let a = await dbInstance(options);
    let cdr = a.getOracle("oracle1");

    cdr((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.execute("select * from DUAL", (err, res) => {
            console.log(res);
        });
    });

    cdr((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.execute("select * from DUAL", (err, res) => {
            console.log(res);
        });
    });

    cdr((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.execute("select * from DUAL", (err, res) => {
            console.log(res);
        });
    });

    cdr((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.execute("select * from DUAL", (err, res) => {
            console.log(res);
        });
    });

    cdr((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.execute("select * from DUAL", (err, res) => {
            console.log(res);
        });
    });

    let cdr2 = a.getPostgres("postgresql1");

    cdr2((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("SELECT NOW()", (err, result) => {
            if (err) {
                return console.error("Error executing query", err.stack);
            }
            console.log(result.rows);
        });
    });

    cdr2((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("SELECT NOW()", (err, result) => {
            if (err) {
                return console.error("Error executing query", err.stack);
            }
            console.log(result.rows);
        });
    });

    cdr2((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("SELECT NOW()", (err, result) => {
            if (err) {
                return console.error("Error executing query", err.stack);
            }
            console.log(result.rows);
        });
    });

    cdr2((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("SELECT NOW()", (err, result) => {
            if (err) {
                return console.error("Error executing query", err.stack);
            }
            console.log(result.rows);
        });
    });

    let cdr3 = a.getMySQL("mysql1");

    cdr3((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("select * from test", (err, res) => {
            console.log(res);
        });
    });

    cdr3((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("select * from test", (err, res) => {
            console.log(res);
        });
    });

    cdr3((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("select * from test", (err, res) => {
            console.log(res);
        });
    });

    cdr3((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("select * from test", (err, res) => {
            console.log(res);
        });
    });

    cdr3((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("select * from test", (err, res) => {
            console.log(res);
        });
    });

    cdr3((err, conn) => {
        if (err) {
            return console.log(err);
        }

        conn.query("select * from test", (err, res) => {
            console.log(res);
        });
    });
}

hello();

HomePage

Github © Page

NPM © Page

License

MIT © Park and Kim

MIT © Park and Kim