Is there any easy way to create multiple datasource by any script?

Hey Guys,

I’m finding a solution to create multiple datasource by any script? because I have 50+ database to configure with Lucee. I’m doing manually by Lucee admin panel so I am looking for a good solution though. I would really appreciated if anyone has any solution out there!!

Note: Which file has stored these details on the server side?

Abhilash S V

Don’t forget to tell us about your stack!

OS: ???
Java Version: ???
Tomcat Version: ???
Lucee Version: ???


1 Like

You will need to tweak this a bit as I write terrible code and no I didnt check this as its roughly what I have, but cant copy due to work obligations.

Create a database in mysql or something with all 50 of your other database,usernames, passwords, connection settings, You can then do something like this.

<CFLOOP QUERY="qDatabases">

 <cffile action = "write" 
file = "C:\lucee\tomcat\webapps\root\application_dsn.defaults.txt" 
output = "C:\lucee\tomcat\webapps\root\application_dsn.defaults.#now#.txt"
#this.datasources["#qDatabases.QconnectName#"] = {
  class: '#qDatabases.QconnectClass#'
  bundleVersion: '#qDatabases.Qversion#'
  connectionString: '#qDatabases.QConnStatic#://'
  username: "#qDatabases.username#"
  password: "encrypted:#qDatabases.password#"
  <--- next ---> 


there are examples for scripting datasources via application.cfc at the bottom of the edit datasource page in the admin

to do it programmatically

the server configuration is stored in

the web configuration is stored in

1 Like

Thanks for the reply @Terry_Whitney, @Zackster
Let me see them and will update you if its helps me!