setting up SQL datasource and login in application.cfm

I just recently switched my website's database from Access to SQL Server 2005, and I've heard that it's better to place the database name, username and password in my site's application.cfm file, rather than directly in my queries.  

I need help with setting up my application.cfm file, as I've never done this before.  What should my code look like?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


It is better to place in the CFAdmin than in the application.cfm or the files

However, in the application.cfm you would have:

<cfset mydsn="MyDataSourceName">
<cfset username = "Myusername">

Then use use a variable

<cfquery datasource="#mydsn#" etc... >

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LTrout1Author Commented:
Thanks for your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.