Database operations
11
Connecting to a data source with ODBC Socket
In ColdFusion 5, an ODBC Data Source Name (DSN) entry that was created with the ODBC
Data Source Administrator would automatically appear in the list of data sources in the
ColdFusion Administrator. It does not appear automatically in ColdFusion MX; you must
manually add the ODBC DSN entry.
To manually add the ODBC DSN entry:
1.
In the ColdFusion MX Administrator, select Data & Services > Data Sources.
2.
In the Add New Data Source Name box, do the following:
a
In the Data Source Name text box, enter the data source name.
You can use the same name as the ODBC DSN entry.
b
In the Driver drop-down list box, select ODBC Socket.
c
Click Add.
3.
In the ODBC DSN drop-down list box, select the ODBC DSN name.
4.
Click Submit.
For more information, see the “Data Source Management” chapter of
Configuring and
Administering ColdFusion MX
.
Session management
ColdFusion MX lets you use J2EE sessions for session management. For backward compatibility,
J2EE session management is disabled by default. However, you should enable this feature
whenever possible. For more information, see “Using Persistent Data and Locking” in
ColdFusion
MX Developer’s Guide
.
QueryColumn object
In ColdFusion MX
, t
he QueryColumn object is even more like an array than in ColdFusion 5, as
the following examples show:
•
The QueryColumn object is derived by referencing a query using associative array notation;
for example:
query1['firstName']
•
You can set a query column to an array element; for example:
<cfset query1['col'] = array2['moo']>
Data type of query results
ColdFusion 5 stores data in the query object as a string, regardless of how the data is stored in the
database. When it outputs a piece of data, it just writes out the string. ColdFusion MX stores data
in the query object differently, depending on its database type (for example, it might store a
number as a Java Double). ColdFusion MX outputs the data by converting the stored type to a
string, which might differ from the string that ColdFusion 5 outputs. If you need your output to
be in a particular format, use the number and/or date format functions.