ColdFusion Tutorial – Examining Your Database
May 19, 2006 | 0 comments
Page 4 — Examining Your Database
This is the webmaster’s equivalent of checking yourself for lumps. It’s important to scout your databases for stuff that might confuse ColdFusion later. These include:
- Field names should be devoid of spaces. Use the underscore character, like new_items instead of “new items.” If your database was set up by someone else, budget some time to explain to them why rewriting all of their database queries and macros will be worth it in the long run. Smile as you say this.
- Use key fields. Most database programs set these up automatically when you create a new table. Keys will greatly reduce the CPU time ColdFusion uses to search your database.
- Divide, divide, divide. If you’re running ColdFusion on your client’s server, you can use as many DSNs as you like. Use this capability by breaking up unrelated tables into separate databases and setting up each one as an individual DSN. Your CPU and hard drive will love you for it.
- Check permissions on the individual tables in your database and make sure that they have read-access for the username your Web server uses to log in. You’ll also need to enable write-access for tables that will allow user input from the Web.
- Make sure that your databases, tables, and DSNs are named clearly and logically. As a former client used to tell me, “We wanna know that if you get hit by a bus tomorrow we can figure this thing out.” There are actually two schools of thought on this; the other is that unnecessary complexity leads to job security.
- If your fields include large blocks of text, you’ll want to include basic HTML coding within the text itself, including stuff like boldface, italics, and paragraph markers.