[Coldbox 5.6.2][Lucee] Newly created datasources are not persisted

Upgraded to Lucee 5.3.4 from Lucee 5.2.9 causing a few weird issues in the process. Whenever I create a new datasource for MySQL it is never persisted. Even when I copy and paste the datasource parameters as “this.datasources=[dsn]” in the Application.cfc file, as suggested in the Lucee documentation, my dsn is not recognized after server re-starts.
There is now a default “coldbox” datasource in Lucee server admin that seems to persist across server re-starts, but parameters such as database connection credentials, cannot be changed => no persistence between server re-starts, again. It reverts to its default parameters as soon as I re-start the engine. Has anybody come across similar issues?

“install commandbox-cfconfig” then run “cfconfig export to=.cfconfig.json” from within your site root after you’ve configured all of your datasources and any other settings.

It sounds like you have a .cfconfig.json file in your web root which is getting picked up and importe on server start. I would guess you copied it in from a coldbox create app command. this really has nothing to do with the Lucee version and is just how CFConfig works. When you start a server, if there is a .cfconfig.json file in the root, it will get picked up and auto-imported and if that file contains datasources (the default coldbox app templates have a config json file with a single datasource called “coldbox”) then it will overwrite any other datasources you’ve configured manually.

Hi Brad and Daemach,

Yes, you are right. Among other modules, the REST-hmvc template automatically installs the CommandBox-cfconfig () module and generates a default .cfconfig.json file in the root of the project. It probably includes the default “coldBox” datasource that always appears in the Lucee server administrator after server re-starts and certainly picks it up from that .cfconfig file. Therefore, the solution is to create a new datasource, delete the coldBox datasource in the Lucee administrator and to export to .cfconfig file before re-starting the server. As a result, there is probably no need for this.datasources[dsn] in the Application.cfc file. Many thanks for pointing that out!