Last Update: 3 October 2008
Product: StarSQL
Version: StarSQL 5.x or later
Article ID: SQV00SQ047
StarSQL can be used with ColdFusion MX 7 and ColdFusion 8 applications to access DB2 data. This document explains how to configure a data source in ColdFusion to use StarSQL and provides sample code.
Follow the steps below to configure a data source in ColdFusion so you can use StarSQL for Java to access DB2 data from a ColdFusion application.
In your application, refer to the ColdFusion data source using the ColdFusion Data Source Name (created in Step 3), not the StarSQL Data Source Name. The following sample code demonstrates how to use the Data Source in the cfquery function.
<html>
<head>
<title>Sample ColdFusion Application</title>
</head>
<body>
<!Specify the Data Source Name and SQL statement in the cfquery function>
<cfquery name="Dataset" datasource="DB2Prod">
SELECT COLUMN1, COLUMN2 FROM MYTABLE
</cfquery>
<!Display the result set in a table>
<table border="1">
<cfoutput query="DataSet">
<tr>
<cfloop index="Columns" list="#DataSet.ColumnList#">
<td>
#Evaluate(Columns)#
</td>
</cfloop>
</tr>
</cfoutput>
</table>
</body>
</html>
The information in technical documents comes without any warranty. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The information in technical documents may be gathered from various sources, including IBM, Microsoft, and other organizations.