I’ve been building a new coldfusion application leveraging object oriented approach and stored procedures. While everything works like a charm, the app is very fast due to SPs and optimized mysql code, I would really appreciate if you would help me clear one thing up :) I have dbcode.cfc which as you probably already guessed stores all queries with stored procedures. That said, generally what’s the best approach when it comes to storing global DNS parameters?
1.this can be used for one global DSN
<cfset this.datasource ="myDB">
2.this can also be used for one global DSN
<cffunction name="onApplicationStart" returnType="boolean" output="false"> <cfset application.dsn = "myDB"> <cfset application.username = "userName"> <cfset application.password = "password"> <cfreturn true> </cffunction>
2.1 everything as above but onRequest
3.in my case I could also create a global variables within the dbcode.cfc
<cfset variables.dsn = "myDB"> <cfset variables.username = "userName"> <cfset variables.password = "password">
4.additionally one could use something like this for setting multiple datasources
<cffunction name="onApplicationStart" returnType="boolean" output="false"> <cfset application.myDSNs = StructNew()> <cfset application.myDSNs.1 = "myDB1"> <cfset application.myDSNs.2 = "myDB2"> . . . <!---something similar for usernames and passwords---> </cffunction>
so what’s the most efficient way to handle this sort of thing?