Skip to main content
Participant
October 17, 2006
Question

Setting Username/Password in Application.cfm

  • October 17, 2006
  • 1 reply
  • 590 views
I'm just moving my DB from Access over to MSSql, and I'm having difficulty figuring out how to set a global username/password in Application.cfm.

I am able to set the username and password within the individual queries (using username= and password=) but I'd like to set the username and password within application.cfm so I do not have to go and change each and every cfquery statement throughout my site.

So, essentially, I'm looking to insert code int he Application.cfm which logs into the MSSQL server, so whenever a cfquery is executed, the db is already logged into.

Thanks!
Andrew
This topic has been closed for replies.

1 reply

Inspiring
October 19, 2006
Andrew,

I don't think you can do that. You might be able to set it up on your datasource within the CF Server Administrator, but otherwise I'm pretty sure you would have to use it on every CFQUERY instance.
Participating Frequently
October 19, 2006
You can set application variables for your user name and password within application.cfm, then use those variables in your cfquery and cfstoredproc tags. That will allow you to change the value in one place instead of having to do it everywhere. As for staying logged on to the server, you may want to consider checking the Maintain Connections option in your advanced settings for your particular data source in ColdFusion Administrator.

Phil