Last Update: 3 October 2008
Product: StarSQL for Java
Version: 2.2 or later
Article ID: SQV00SJ006
StarSQL for Java 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 for Java 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.
CF Data Source Name Provide a simple data source name, such as "DB2Prod." JDBC URL jdbc:StarSQL_JDBC://<hostname or IP address>:446/<RDB Name> Driver Class com.starsql.jdbc.SQDriver Driver Name StarSQL for Java User Name enter a valid DB2 user ID Password enter the password for the DB2 user ID
Refer to the StarSQL for Java User's Guidefor information about composing a JDBC URL using optional data source properties.
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.