{"id":13527230,"url":"https://github.com/mariadb-corporation/mariadb-connector-nodejs","last_synced_at":"2025-05-14T00:07:53.756Z","repository":{"id":40243517,"uuid":"122999378","full_name":"mariadb-corporation/mariadb-connector-nodejs","owner":"mariadb-corporation","description":"MariaDB Connector/Node.js is used to connect applications developed on Node.js to MariaDB and MySQL databases. MariaDB Connector/Node.js is LGPL licensed.","archived":false,"fork":false,"pushed_at":"2025-04-25T15:15:49.000Z","size":3986,"stargazers_count":388,"open_issues_count":24,"forks_count":95,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-05-03T09:41:58.285Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mariadb-corporation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-26T16:49:04.000Z","updated_at":"2025-04-29T02:11:32.000Z","dependencies_parsed_at":"2023-10-04T01:03:23.950Z","dependency_job_id":"7645df95-8d5e-455d-8409-87e8779a72b4","html_url":"https://github.com/mariadb-corporation/mariadb-connector-nodejs","commit_stats":{"total_commits":1083,"total_committers":33,"mean_commits":32.81818181818182,"dds":"0.21606648199445988","last_synced_commit":"c00e0f1bc84945c3f8d9fda6e5caaa0732cce2ad"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariadb-corporation%2Fmariadb-connector-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariadb-corporation%2Fmariadb-connector-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariadb-corporation%2Fmariadb-connector-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariadb-corporation%2Fmariadb-connector-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mariadb-corporation","download_url":"https://codeload.github.com/mariadb-corporation/mariadb-connector-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253480857,"owners_count":21915249,"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":[],"created_at":"2024-08-01T06:01:43.673Z","updated_at":"2025-05-14T00:07:53.739Z","avatar_url":"https://github.com/mariadb-corporation.png","language":"JavaScript","funding_links":[],"categories":["Repository","JavaScript"],"sub_categories":["Database"],"readme":"\u003cp style=\"text-align: center;\"\u003e\n  \u003ca href=\"https://mariadb.com/\"\u003e\n    \u003cimg src=\"https://mariadb.com/kb/static/images/logo-2018-black.png\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# MariaDB Node.js connector\n\n[![npm package][npm-image]][npm-url] \n[![Test Build][travis-image]][travis-url]\n[![License (LGPL version 2.1)][licence-image]][licence-url]\n[![codecov][codecov-image]][codecov-url]\n\n**Non-blocking MariaDB and MySQL client for Node.js.**\n\nMariaDB and MySQL client, 100% JavaScript, with TypeScript definition, with the Promise API, distributed under the LGPL license version 2.1 or later (LGPL-2.1-or-later)\n\n\n## Documentation\n\nSee [promise documentation](https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/documentation/promise-api.md) for detailed API. \n\n[Callback documentation](https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/documentation/callback-api.md) describe the callback wrapper for compatibility with existing drivers.\n\nSee [dedicated part](https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/documentation/promise-api.md#migrating-from-2x-or-mysqlmysql2-to-3x) for migration from mysql/mysql2 or from 2.x version.\n\n   \n## Why a New Client?\n\nWhile there are existing MySQL clients that work with MariaDB, (such as the [`mysql`](https://www.npmjs.com/package/mysql) and [`mysql2`](https://www.npmjs.com/package/mysql2) clients), the MariaDB Node.js Connector offers new functionality, like [Insert Streaming](#insert-streaming), [Pipelining](#pipelining), [ed25519 plugin authentication](https://mariadb.org/history-of-mysql-mariadb-authentication-protocols/) while making no compromises on performance.\n\nConnector is production grade quality, with multiple features:\n* superfast batching\n* fast pool\n* easy debugging, trace pointing to code line on error\n* allows data streaming without high memory consumption\n* pipelining\n* metadata skipping (for MariaDB server only)\n* sql file import\n* ...\n\nsee some of those features:\n\n### Insert Streaming \n\nUsing a Readable stream in your application, you can stream `INSERT` statements to MariaDB through the Connector.\n\n```javascript\n    \n    https.get('https://someContent', readableStream =\u003e {\n        //readableStream implement Readable, driver will stream data to database \n        connection.query(\"INSERT INTO myTable VALUE (?)\", [readableStream]);\n    });\n```\n \n### Pipelining\n\nWith Pipelining, the Connector sends commands without waiting for server results, preserving order.  For instance, consider the use of executing two `INSERT`  statements.\n\n\u003cp style=\"text-align: center;\"\u003e\n    \u003cimg src=\"./documentation/misc/pip.png\" alt=\"pipelining example\"/\u003e\n\u003c/p\u003e\n\nThe Connector doesn't wait for query results before sending the next `INSERT` statement. Instead, it sends queries one after the other, avoiding much of the network latency.\n\nFor more information, see the [Pipelining](/documentation/pipelining.md) documentation.\n \n### Bulk insert\n\nSome use cases require a large amount of data to be inserted into a database table. By using batch processing, these queries can be sent to the database in one call, thus improving performance.\n\nFor more information, see the [Batch](/documentation/batch.md) documentation.\n\n\n## Benchmarks\n\nMariaDB provides benchmarks comparing the Connector with other Node.js MariaDB/MySQL clients, including: \n\n* [`promise-mysql`](https://www.npmjs.com/package/promise-mysql) version 5.2.0 + [`mysql`](https://www.npmjs.com/package/mysql) version 2.18.1\n* [`mysql2`](https://www.npmjs.com/package/mysql2) version 3.1.0\n\nSee the [Benchmarks](./documentation/benchmarks.md) page for multiple results.\n\n#### query\n\n```\nselect 100 int\n            mysql :  2,738.7 ops/s ± 1.3% \n           mysql2 :  2,404.9 ops/s ± 1.3%  (  -12.2% )\n          mariadb :  5,650.8 ops/s ± 1.4%  ( +106.3% )\n```\n![select 100 int benchmark results](https://quickchart.io/chart/render/zm-ef74089a-be91-49f1-b5a0-5b9ac5752435?data1=2739\u0026data2=2405\u0026data3=5651)\n\n#### execute\n\n##  select 100 int - BINARY\n\n```\nselect 100 int - BINARY\n           mysql2 :  2,473.4 ops/s ± 1.3% \n          mariadb :   10,533 ops/s ± 1.7%  ( +325.9% )\n```\n![select 100 int - BINARY benchmark results](https://quickchart.io/chart/render/zm-36b213f4-8efe-4943-8f94-82edf94fce83?data1=2473\u0026data2=10533)\n\n\n## Quick Start\n\nThe MariaDB Connector is available through the Node.js repositories. You can install it using npm :\n\n```\n$ npm install mariadb\n```\nexample:\n```js\nconst mariadb = require('mariadb');\nconst pool = mariadb.createPool({host: process.env.DB_HOST, user: process.env.DB_USER, connectionLimit: 5});\n\nasync function asyncFunction() {\n  let conn;\n  try {\n\n\tconn = await pool.getConnection();\n\tconst rows = await conn.query(\"SELECT 1 as val\");\n\t// rows: [ {val: 1}, meta: ... ]\n\n\tconst res = await conn.query(\"INSERT INTO myTable value (?, ?)\", [1, \"mariadb\"]);\n\t// res: { affectedRows: 1, insertId: 1, warningStatus: 0 }\n\n  } finally {\n\tif (conn) conn.release(); //release to pool\n  }\n}\n```\n## Contributors\n\nA big thanks to all contributors\n\n\u003ca href=\"https://github.com/mariadb-corporation/mariadb-connector-nodejs/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=mariadb-corporation/mariadb-connector-nodejs\u0026max=180\u0026columns=15\"  alt=\"contributors list\"/\u003e\n\u003c/a\u003e\n\n## Contributing \n\nIf you would like to contribute to the MariaDB Node.js Connector, please follow the instructions given in the [contributing guide.](/CONTRIBUTING.md)\n\nTo file an issue or follow the development, see [JIRA](https://jira.mariadb.org/projects/CONJS/issues/).\n\n\n[travis-image]:https://travis-ci.com/mariadb-corporation/mariadb-connector-nodejs.svg?branch=master\n[travis-url]:https://app.travis-ci.com/github/mariadb-corporation/mariadb-connector-nodejs\n[npm-image]:https://img.shields.io/npm/v/mariadb.svg\n[npm-url]:http://npmjs.org/package/mariadb\n[licence-image]:https://img.shields.io/badge/license-GNU%20LGPL%20version%202.1-green.svg?style=flat-square\n[licence-url]:http://opensource.org/licenses/LGPL-2.1\n[codecov-image]:https://codecov.io/gh/mariadb-corporation/mariadb-connector-nodejs/branch/master/graph/badge.svg\n[codecov-url]:https://codecov.io/gh/mariadb-corporation/mariadb-connector-nodejs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariadb-corporation%2Fmariadb-connector-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmariadb-corporation%2Fmariadb-connector-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariadb-corporation%2Fmariadb-connector-nodejs/lists"}