Hi guys,
i have build my application.cfc file and i am using the following to declare my dns under application start session :
<cffunction name=“On ApplicationStart”>
<cfset application.dns=“MyDNS”>
…
…
now how can i call that #application.dns# as my data source in other cfm pages ?
thank
Don’t you mean dsn? Dns is domain name 
Anyway to call it on a cfm page it should be just a case of using that reference you’ve put in onApplication. Ie
<cfquery name=“myQuery” datasource=“#application.dsn#”>
Select ID from myDBTable
</cfquery>
or do you mean something else?
By the way application variables are values persisted in memory throughout the life of the application. They don’t relate to sessions which are used for each visitor to your application.
Hope that helps
Cheers
James
Thanks Clarkee21 ,
i am trying to use that but it does not work
<cfset DNS1=“#application.dsn#”>
<cfquery name=“myQuery” datasource=“#DNS1#”>
Select ID from myDBTable
</cfquery>
it says DNS1 is undefined…
what is the best way to define the dns …is it as an application variable or session one…anyway my whole application uses 2 different dns’s .
any idea ?
Thanks
DSN = Datasource Name.
DNS means something completely different so it’s best to get terminology right to avoid confusion.
Have you defined a name for your application? It sounds like ColdFusion might be rebuild the application on every request.
At the top of the Application.cfc place this:-
<cfset this.applicationame = “myApplication” >
There are a few more settings that you can define here but look those up on Adobe’s online docs.
You don’t need the DNS1 = “#application.dsn#” either. All your doing here is duplicating variables. Just use application.dsn directly and it’s less for you to manage / remember then 
Cheers
James
Hi ,
Thanks a lot for the follow up and for the correction. You are right better using the right terminology…
I am using dsn instead… i think was just a typo …
I have build a new test page where i have to test that #application.dsn# and it is working just fine…
thanks bro…