Mysql Driver in nodejs

Posted by in Other

I was looking forward to add a mysql driver for the nodejs application i am currently working. Since I din find a very good comparison of all the modules for mysql anywhere, I am putting my compiled review here.

[ A driver is a software module, component which can be used to act as a adapter for one software application to another, Its used to connect different software module in software design. Its like a real world driver who are expert handling the respective vehicles. eg: pilot for airplanes ]

Available Node Drivers:

out of the above 5 popular drivers i find three of them which can be competitors: node-mysql, db-mysql , node-mysql-activerecord

node-mysql

  • Advantages
    • This driver has been tested very well and appears to be in maintenance phase of its software life cycle.
    • A very simple interface to mysql database.
    • Supports scaling of db through multiple master/slave configuration, a good option if u want to scale your app in future.
    • Supports queries in parallel.
    • A good set of events.
    • Multiple query support, i.e. in 1 query you can provided multiple sub queries, and an array of result for each query will be returned.
  • Disadvantages
    • Does not have a query chaining mechanism, so have to write all the queries in native sql, which is good but query chaining simplifies task when working with objects

db-mysql

  • Advantages
    • Query Chaining
    • A very simple implementation of mysql, very good when rapidly developing applications.
  • Disadvantages
    • No scaling support yet.
    • Even set is too limited.

node-mysql-activerecord 

This appears to be a similar implementation of active record from rails to nodejs, which is great. Its written on top of node-mysql module, so it will have advantages from there as well as its own.

  • Advantages
    • Query Chaining available, actually better than db-mysql
    • Scaling support, you can add multiple pool.

Conclusion

I think that node-mysql or node-mysql-activerecord are good to go with my project. If u need a simpler implementation of mysql and your project is just a class experiment i will suggest db-mysql is a good option.

Do let me know what you will choose for your project in comments

Happy Hacking