RE: [coldbox:16542] [coldbox 3.1.0 - newbie] database connection issue

The ColdBox settings for data sources don’t actually contain database connections-- just the information to use the data source like name, username and password.

This sounds like a general ColdFusion issue related to connection pooling. I would recommend you check into the “Validation Query” setting for your data sources in the ColdFusion administrator. I just use “select 1” as my validation query. It’s a little bit of additional database chatter, but basically CF runs that SQL against a pooled database connection each time it retrieves it from the pool to use. (once per request, basically)

Your only other options are:

  • Turn off connection pooling (“Maintain Connections” setting) which will require CF to log in to the database again every request (worse than a validation query in my opinion)
  • Don’t restart your DB server without also cycling CF.



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform:

Thank you… I have found part of the problem… It is trying to connect to the wrong datasource after the db has been restarted. It is picking up a different environment’s datasource. Not sure how this happens… any ideas?

And to clarify, when CF is restarted it uses the correct environment…

Do you have any other applications that might be using the same application name?

It is kind of a shared hosting environment, so I guess it would be possible, but it picks up the right environment when it is started fresh, but seems to get confused when the database is restarted and picks up another environment defined in the same application.