Can't Create Datasource In Lucee 6

We have a naming convention for our datasources that I would like to continue to use but Lucee 6 is saying that “Data source Names must match proper variable naming conventions” when I try to create a new datasource in Lucee Server Admin. The naming convention matches the site URL and can use periods, underscores and dashes. Example: 6149.xxx-xxxx.net_xxx

I’ve tried finding documentation for the proper naming conventions but can’t find one. Is this a requirement in Lucee or is it a bug (I hope!)?

OS: Windows Server 2012 R2 Datacenter
Java Version: 1.8.0_181 (Oracle Corporation) 64bit
Tomcat Version: Tomcat/8.5.33
Lucee Version: Lucee 6.0.0.585

I think Lucee’s rules for variable naming are similar to Adobe’s which you can find here:

https://helpx.adobe.com/coldfusion/developing-applications/the-cfml-programming-language/using-coldfusion-variables/creating-variables.html

So in your example, the initial digits and the hyphen wouldn’t pass.

1 Like

Does this help you?

Thank you both for the replies. Do I have to switch to using this.datasources or is there a way I can do that using the admin tag? Surrounding the quotes with brackets didn’t work.

admin
	action="updateDatasource"
	name="#my.crazy.dsn#"
	newName="#my.crazy.dsn#"

What didn’t work exactly? Any error? Are those DSN hostnames or variables? If these are no variables but static host name strings (what they look like), you dont need any pound/hash signs there.

This issue is to do with creating datasources, in my case with the CFAdmin tag, in the OPs case using the admin.

Lucee 5 would let you do anything, so our datasource name foo-dev is fine, but with Lucee 6 when creating a datasource it must match [a-zA-Z0-9_]* so we can no longer create foo-dev. We can do a

this.datasources["foo-dev"] = {}

But in my case, not all the systems can use the this scope.

The error message says that the names of datasource must follow the variable naming convention.

We currently have about 3000 datasources. When we sign up a new site, we dynamically add a datasource that is based on their domain name using the admin tag and updateDatasource. Lucee 6 does not accept the periods or dashes that the current datasources are populated with and throws an error (names of datasource must follow the variable naming convention). Changing the naming convention for the datasource means making changes in at least 344 files for me. If there’s some way to avoid this change, that would be wonderful!