meteor-mysql
meteor-mysql copied to clipboard
Manage (open/close) multiple mysql connections
If you have different templates that have to connect to different mysql databases. What's the best approach to (re)use multiple liveDB instances?
- Create a new liveDB for every subscription and close it onStop
- Reuse a global liveDB var
- Reuse a liveDB var that is retrieved from a connection manager.
- Use the node-mysql connection pool (possible?)
Right now I'm using option 1: I use the Template.OnDestroyed function to stop the mysql connection if a user navigates away from the page where it's used. However, I'm also using a dynamic subscription which also calls the same subscription.stop(). So on every change, a new liveDB connection object is created. What are your ideas?
Why would you use different connections for different databases? It is not required to specify a database in the connection settings.
Ow I mean different mysql servers! On Aug 27, 2015 7:00 PM, "Ben Green" [email protected] wrote:
Why would you use different connections for different databases? It is not required to specify a database in the connection settings.
— Reply to this email directly or view it on GitHub https://github.com/numtel/meteor-mysql/issues/31#issuecomment-135493105.