Skip to content

Commit 03f466b

Browse files
author
haoxin
committed
add example of using pool directly
1 parent f4b0744 commit 03f466b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,22 @@ Unlike `end()` the `destroy()` method does not take a callback argument.
210210

211211
## Pooling connections
212212

213+
Use pool directly.
214+
```js
215+
var mysql = require('mysql');
216+
var pool = mysql.createPool({
217+
host : 'example.org',
218+
user : 'bob',
219+
password : 'secret'
220+
});
221+
222+
pool.query('SELECT 1 + 1 AS solution', function(err, rows, fields) {
223+
if (err) throw err;
224+
225+
console.log('The solution is: ', rows[0].solution);
226+
});
227+
```
228+
213229
Connections can be pooled to ease sharing a single connection, or managing
214230
multiple connections.
215231

0 commit comments

Comments
 (0)