numtel / meteor-mysql

Reactive MySQL for Meteor
MIT License
343 stars 41 forks source link

Manage (open/close) multiple mysql connections #31

Open sushitommy opened 9 years ago

sushitommy commented 9 years ago

If you have different templates that have to connect to different mysql databases. What's the best approach to (re)use multiple liveDB instances?

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?

numtel commented 9 years ago

Why would you use different connections for different databases? It is not required to specify a database in the connection settings.

sushitommy commented 9 years ago

Ow I mean different mysql servers! On Aug 27, 2015 7:00 PM, "Ben Green" notifications@github.com 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.