Accessing a MySQL database from Node.JS
I just pushed node.dbslayer.js to GitHub, a very basic and easy-to-use interface to DBSlayer.
What is DBSlayer?
The DBacesslayer aka DBSlayer is a lightweight database abstraction layer suitable for high-load websites where you need the scalable advantages of connection pooling. Written in C for speed, DBSlayer talks to clients via JSON over HTTP, meaning it’s simple to monitor and can swiftly interoperate with any web framework you choose.
Developed by the New York Times to distribute the load of their MySQL servers, DBSlayer allows us to perform queries in a non-blocking way. Running a SQL query is as simple as:
connection.query("SELECT * FROM TABLE").addCallback(function(result){ for (var i = 0, l = result.ROWS.length; i < l; i++){ var row = result.ROWS[i]; // do something with the data } });
Have fun!


