ColdFusion MX uses JDBC drivers to interact with databases; for example, to query, write, and update a database. (JDBC is an Application Programming Interface (API) for Java programs to access data.) To connect to Open Database Connectivity (ODBC) data sources, you can use the bundled Merant Type 4 database drivers or the SQL Link Type 3 database drivers. ColdFusion MX no longer uses the JDBC-ODBC bridge driver.
This section describes the known incompatibilities between the ODBC features of ColdFusion 5 and the JDBC features of ColdFusion MX, in addition to those that are documented in "CFML tags and attributes" and "CFML functions and variables" (for example, cfquery
, cfcatch
, and cfreport
).
For more information about the Merant JDBC drivers included with ColdFusion MX, see http://www.merant.com.
In ColdFusion 5, an ODBC Data Source Name (DSN) entry that was created with the ODBC Data Source Administrator would automatically show up in the list of data sources in the ColdFusion Administrator. It does not in ColdFusion MX; you must manually add the ODBC DSN entry.
You can use the same name as the ODBC DSN entry.
For more information about data source management, see Administering ColdFusion MX.
ColdFusion MX now uses J2EE sessions as its default session management technique. For more information about using persistent data and locking, see Developing ColdFusion MX Applications with CFML.
The QueryColumn object is even more like an array than in ColdFusion 5, as shown by the following examples:
query1['firstName']
<cfset query1['col'] = array2['moo']>
#isArray(query1['firstName'])#
<cfset joeArray[1] = query1['firstName']
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 may 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.
Certain database and operating system combinations can lead to query data being returned with space characters appended to the end. If you encounter this whitespace padding, you can remove it using the SQL command rtrim()
, if your database supports the SQL rtrim
function. For example, if SELECT ColA, ColB FROM TableA
returns results for ColB
with whitespace padding, you can rewrite the query as follows:
SELECT ColA, rtrim(ColB) AS ColB FROM TableA