You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,18 +18,19 @@ MariaDB and MySQL client, 100% JavaScript, with TypeScript definition, with the
18
18
19
19
## Documentation
20
20
21
-
See [promise documentation](https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/documentation/promise-api.md) for detailed API.
21
+
See [promise documentation](https://mariadb.com/docs/connectors/mariadb-connector-nodejs/connector-nodejs-promise-api) for detailed API.
22
22
23
-
[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.
23
+
[Callback documentation](https://mariadb.com/docs/connectors/mariadb-connector-nodejs/connector-nodejs-callback-api) describes the callback wrapper for compatibility with existing drivers.
24
24
25
-
See [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.
25
+
See [dedicated part](https://mariadb.com/docs/connectors/mariadb-connector-nodejs/connector-nodejs-promise-api#migrating-from-2.x-or-mysql-mysql2-to-3.x) for migration from mysql/mysql2 or from 2.x version.
26
26
27
27
28
-
## Why a New Client?
28
+
## Why a specific MariaDB Client?
29
29
30
30
While 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.
31
31
32
-
Connector is production grade quality, with multiple features:
32
+
The Connector is production grade quality, with multiple features:
* easy debugging, trace pointing to code line on error
@@ -63,13 +64,13 @@ With Pipelining, the Connector sends commands without waiting for server results
63
64
64
65
The 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.
65
66
66
-
For more information, see the [Pipelining](/documentation/pipelining.md) documentation.
67
+
For more information, see the [Pipelining](https://mariadb.com/docs/connectors/mariadb-connector-nodejs/connector-nodejs-pipelining) documentation.
67
68
68
69
### Bulk insert
69
70
70
71
Some 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.
71
72
72
-
For more information, see the [Batch](/documentation/batch.md) documentation.
73
+
For more information, see the [Batch](https://mariadb.com/docs/connectors/mariadb-connector-nodejs/connector-nodejs-batch-api) documentation.
Some 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.
8
+
Please update your bookmarks and visit the new location for the most up-to-date documentation.
9
9
10
-
For instance, say you want to create a basket with five items.
11
-
12
-
```javascript
13
-
connection.beginTransaction();
14
-
connection.query("INSERT INTO BASKET(customerId) values (?)", [1], (err, res) => {
15
-
//must handle error if any
16
-
constbasketId=res.insertId;
17
-
try {
18
-
connection.batch("INSERT INTO basket_item(basketId, itemId) VALUES (?, ?)",[
19
-
[basketId, 100],
20
-
[basketId, 101],
21
-
[basketId, 103],
22
-
[basketId, 104],
23
-
[basketId, 105]
24
-
]);
25
-
//must handle error if any
26
-
connection.commit();
27
-
} catch (err) {
28
-
connection.rollback();
29
-
//handle error
30
-
}
31
-
});
32
-
```
33
-
34
-
### Performance comparison
35
-
36
-
Some benchmark to do some 100 inserts with one parameter of 100 characters :
37
-
(benchmark source - see [standard insert](benchmarks/benchs/insert_pipelining.js) and [batch insert](benchmarks/benchs/insert_batch.js) )
38
-
<palign="center">
39
-
<img src="./misc/batch-bench.png">
40
-
</p>
41
-
42
-
### Configuration
43
-
44
-
There is one thing to pay attention : MySQL / MariaDB servers have a global option [max_allowed_packet](https://mariadb.com/kb/en/library/server-system-variables/#max_allowed_packet) that limit the maximum packet exchange size.
45
-
If connector send more data than these limit, socket will be immediately dropped.
46
-
47
-
default server values :
48
-
- since MariaDB 10.2.4 : 16M
49
-
- since MariaDB 10.1.7 : 4M
50
-
- before MariaDB 10.1.7 : 1M
51
-
52
-
You can check servers value using query `select @@max_allowed_packet`.
53
-
54
-
Connection option "maxAllowedPacket" permit to connector to behave accordingly : if maxAllowedPacket is set to 1048576 (=1M),
55
-
packet send to server will be split in packet less than 1M to avoid any issue.
10
+
---
11
+
*This file is kept for backward compatibility. Last updated: 27/06/2025*
0 commit comments