{"id":15003399,"url":"https://github.com/cityssm/mssql-multi-pool","last_synced_at":"2025-10-30T11:30:21.369Z","repository":{"id":36977485,"uuid":"306083295","full_name":"cityssm/mssql-multi-pool","owner":"cityssm","description":"A simple way to manage connections to multiple SQL Server databases using the Node.js Tedious driver.","archived":false,"fork":false,"pushed_at":"2025-01-20T04:21:27.000Z","size":1187,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-02T08:01:40.161Z","etag":null,"topics":["connection-pool","hacktoberfest","mssql","node-mssql","pool","sql","tedious"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@cityssm/mssql-multi-pool","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cityssm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-21T16:25:32.000Z","updated_at":"2025-01-14T16:44:11.000Z","dependencies_parsed_at":"2024-04-11T19:29:44.770Z","dependency_job_id":"a3d828af-5cc8-496c-bc1f-0180112ae64e","html_url":"https://github.com/cityssm/mssql-multi-pool","commit_stats":{"total_commits":78,"total_committers":5,"mean_commits":15.6,"dds":0.08974358974358976,"last_synced_commit":"e3c13298e4ab4201282aef213f1e1f24678f5101"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fmssql-multi-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fmssql-multi-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fmssql-multi-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fmssql-multi-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cityssm","download_url":"https://codeload.github.com/cityssm/mssql-multi-pool/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238955571,"owners_count":19558452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["connection-pool","hacktoberfest","mssql","node-mssql","pool","sql","tedious"],"created_at":"2024-09-24T18:58:16.050Z","updated_at":"2025-10-30T11:30:21.363Z","avatar_url":"https://github.com/cityssm.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mssql-multi-pool\n\n[![npm](https://img.shields.io/npm/v/@cityssm/mssql-multi-pool)](https://www.npmjs.com/package/@cityssm/mssql-multi-pool)\n[![codecov](https://codecov.io/gh/cityssm/mssql-multi-pool/branch/main/graph/badge.svg?token=865Y3ZDNMC)](https://codecov.io/gh/cityssm/mssql-multi-pool)\n[![Coverage Testing](https://github.com/cityssm/mssql-multi-pool/actions/workflows/coverage.yml/badge.svg)](https://github.com/cityssm/mssql-multi-pool/actions/workflows/coverage.yml)\n[![DeepSource](https://app.deepsource.com/gh/cityssm/mssql-multi-pool.svg/?label=active+issues\u0026show_trend=true\u0026token=4Yz1B7bqP-sZ50AZnjXpoEos)](https://app.deepsource.com/gh/cityssm/mssql-multi-pool/)\n\nA simple way to manage connections to multiple SQL Server databases using the Node.js Tedious package ([node-mssql](https://github.com/tediousjs/node-mssql)).\n\n- 💪 Fully typed. Exports all types from node-mssql as well.\n- 🧠 Automatically uses the [MSNodeSQLv8 driver](https://www.npmjs.com/package/msnodesqlv8)\n  on Windows (when available) to support Windows authentication,\n  and the [Tedious driver](https://www.npmjs.com/package/tedious) on other operating systems.\n- 🧹 Automatically cleans up all pools on exit.\n\n## Why?\n\nThe fantastic [node-mssql](https://github.com/tediousjs/node-mssql) package\nprovides an easy and reliable way to connect to _one_ SQL Server instance.\n\nConnecting to multiple SQL Server instances is where things get trickier.\nNot too tricky, but it is more involved as you can't rely on the global pool.\nThere is some sample code in the [node-mssql README](https://github.com/tediousjs/node-mssql) that shows how to do it.\n\nThis project implements that sample code. 👌\n\n## Installation\n\n```sh\nnpm install @cityssm/mssql-multi-pool\n```\n\n💡 If you want to use `msnodesqlv8`, it must be installed separately.\n\n## Usage\n\nReplace the `connect(config)` command from the `mssql` package\nwith the `connect(config)` command from the `@cityssm/mssql-multi-pool` package.\n\nIf the configuration object describes an unseen database, a new pool is made.\nOtherwise, the previously made pool is used.\n\n```typescript\nimport mssqlMultiPool, { type mssql } from '@cityssm/mssql-multi-pool'\n\nconst pool = await mssqlMultiPool.connect(config)\n\n// Use the `mssql` package like before.\n\nconst results = (await pool\n  .request()\n  .input('workOrderNumber', '2024-01234')\n  .query(\n    'select * from WorkOrders where workOrderNumber = @workOrderNumber'\n  )) as mssql.IResult\u003cWorkOrder\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcityssm%2Fmssql-multi-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcityssm%2Fmssql-multi-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcityssm%2Fmssql-multi-pool/lists"}