PROTECTED]
Sent: Thursday, December 13, 2001 3:46 PM
Subject: RE: Can we have two datasources with the same name?
If I understand what you are asking, why do you not just set your DSN as
an Application variable?
cfset Application.DataSource = dev or cfset Application.DataSource =
test
You
]]
Sent: Friday, December 14, 2001 9:42 AM
To: CF-Talk
Subject: Re: Can we have two datasources with the same name?
I used to make that same mistake. However, if you use #application.dsn#,
that means that you have to lock every query - this really hurts
performance. Use a non-shared scope (like
]]
Sent: Friday, December 14, 2001 9:42 AM
To: CF-Talk
Subject: Re: Can we have two datasources with the same name?
I used to make that same mistake. However, if you use #application.dsn#,
that means that you have to lock every query - this really hurts
performance. Use a non-shared scope
Create a template and add it to all of the files needed. All you need it
one line.
datasource.cfm
cfset datasource = changethenameofthedatasourcehere
Then for your queries:
cfquery name=whatever datasource=#datasource#
select *
from table
/cfquery
So the files would look like this:
If I understand what you are asking, why do you not just set your DSN as
an Application variable?
cfset Application.DataSource = dev or cfset Application.DataSource =
test
You would use whichever one you wanted while testing and then
just change this one spot in your Application.cfm file when
I do something similar, but in application.cfm. That way I don't have to change a
bunch of individual templates. Instead of a CFIF, you could use a CFSWITCH to choose
between dev, test and live servers so no code needs to be changed anywhere as you move
from server to server.
CFIF (NOT
If you use an app var in the CFQUERY statement you have to place an application-level
CFLOCK around your query.
I forgot to mention in my earlier post on this thread that I set request vars for the
local and live settings in application.cfm. Does the same job w/o need for locking.
No idea
Put the datasource in your Application.cfm file that way you only have to
comment and uncomment one line of code
On Thu, 13 Dec 2001, bajaria aslam wrote:
Hi.
Suppose I have a datasource datasource1 pointing to
Database1 on a SQL Server called test.
Can I have another datasource called
8 matches
Mail list logo