Using Sql With Coldfusion - MACROMEDIA COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX Getting Started

Building coldfusion mx applications
Table of Contents

Advertisement

The result of the preceding SQL statement contains the following data:
LastName
Brown
Note: The preceding SQL SELECT examples use single-quotation marks around the value. SQL
uses single-quotation marks around text values. Most database systems also accept double-
quotation marks. Do not enclose numeric values in quotation marks.
Sorting the results
You use the ORDER BY clause to sort the result rows. The following SQL statement returns an
alphabetic list of people sorted by last name, and then first name, from the Clients table:
SELECT * FROM Clients Order By LastName, FirstName
The default is to return the results in ascending order (top to bottom). If you include the DESC
keyword in the ORDER BY clause, the rows are returned in descending order (bottom to top).
The following statement returns a reverse alphabetic list of the Clients table:
SELECT * FROM Clients Order By LastName, FirstName DESC
Note: The SQL SELECT statement is quite powerful. There are several other options for retrieving
data from a SQL database using the SELECT statement, which are not described in this manual. For
more information, consult a SQL reference.

Using SQL with ColdFusion

ColdFusion communicates with your data source through a database interface called Java
Database Connectivity (JDBC). JDBC is a standard application programming interface (API) for
accessing information from different database systems and different storage formats.
About data sources
A data source is a complete database configuration that uses a JDBC driver to communicate with
a specific database. In ColdFusion, you must configure a data source for each database file that
you want to use. After you configure a data source, the ColdFusion server is then capable of
communicating with that data source through the JDBC driver.
You configure data sources in ColdFusion by using the ColdFusion MX Administrator. For
information about how to configure the sample data source file that is supplied for use with Part
II of this manual, see
more information about configuring a data source in ColdFusion, see Installing and Using
ColdFusion MX or ColdFusion MX Developer's Guide.
36
Chapter 3: Database Fundamentals
FirstName
Marie
"Lesson 2: Configuring Your Development Environment" on page
49. For

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents