• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Coldfusion DSN Variables

After you’ve created your Data Source Name (DSN) in ColdFusion Administrator and gone through all the steps in the Bindings panel, you’re ready to start creating recordsets. Every time you create a <cfquery>, you provide the DSN and a username and password if one is required. If you prefer to hand-code your <cfquery> tags, you have to remember what you called the DSN, the username, and the password. Typos happen; things break. Inevitably something happens and you have to change your DSN information. Now you have to go through the entire site making sure to change all instances. Then you have to upload all affected files. You can avoid this mess by using variables for DSN information in your Application.cfm. If you always use the same variable-naming convention for every site you build, it will make things even easier for you. Here’s my usual with placeholder values:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint