Copy link to clipboard
Copied
I am going to start a new project and I am pretty new to the ColdFusion and would liek to start Application.cfc and want to know what's kind the information need specify for whole applications.
Your help and information is great appreciated,
Regards,
Iccsi
You didn't state what version of ColdFusion you were using, but:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-750b.html
Copy link to clipboard
Copied
You didn't state what version of ColdFusion you were using, but:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-750b.html
Copy link to clipboard
Copied
Thanks for the information and the link,
Is it a good idea to have data source information in the Application.cfc, since it is global to the application or it is a good idea to have data source in the cfm file in the application folder?
Thanks again for the information,
Regards,
Iccsi,
Copy link to clipboard
Copied
I usually store the datasource into the application.cfc's THIS scope. But be mindful that I don't believe every ColdFusion version supported this as an application variable.
<cfset THIS.datasource = 'name_of_default_datasource' />
In CF10, once this has been set, you can actually omit the DATASOURCE attribute of a CFQUERY and ColdFusion will use the THIS.datasource value as the default.
Copy link to clipboard
Copied
Thanks for the information and help,
We just need set datasource for THIS scope.
We can just the datasource name what CF Server datasource name, am I right?
Do we need set password to connect the datasource ot every time use user password to connect to datasource?
Thanks again for the information and help,
Regards,
Iccsi,
Copy link to clipboard
Copied
Traditionally, you create datasources in the CF Administrator. Here, you give it a friendly name and define all the criteria to connect to the database (server, database name, username/password).
When you specify the name of the datasource in ColdFusion code, you simply provide the friendly name that you setup in the Administrator, that way you do not have to provide all the connection details over and over.
Be mindful, that there are some values that are required for your APPLICATION to run. The CF Admin may not be setup to allow unnamed applications, so make sure to provide your application a name as well, ie:
<cfset THIS.name = 'myWebApplication' />
Copy link to clipboard
Copied
Thanks a million for helping and information,
Is "THIS" scope case sensetive?
Thanks again,
Regards,
Iccsi,
Copy link to clipboard
Copied
can I use
<CFSET THIS . /> to set all application variables?
Thanks a million again for helping and information,
Regards,
Iccsi,
Copy link to clipboard
Copied
No. The this scope is for setting application config stuff, as detailed here:
http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-750b.html
If you want to set application-scoped variables, set them as - eg - application.varName in your onApplicationStart().
You're asking a lot of Application.cfc questions today. Best go read the docs I'm pointing you to before asking questions, as it will save us all just digging out the docs and suggesting to read them 😉
--
Adam
Copy link to clipboard
Copied
I really appreciated your help and informaiton,
Sure, I will read the link you provided.
I am pretty new for ColdFusion.
Thanks again for your help and patience,
Regards,
Iccsi,
Copy link to clipboard
Copied
You want to know the kind of information you need? That depends on what you are trying to do.