StarQuest Technical Documents

Using StarSQL for Java with ColdFusion

Last Update: 10 September 2014
Product: StarSQL for Java
Version: 2.2 or later
Article ID: SQV00SJ006

Abstract

StarSQL for Java can be used with Adobe ColdFusion to access DB2 data. This document explains how to configure a data source in ColdFusion to use StarSQL for Java and provides sample code.

Solution

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.

  1. Launch the ColdFusion Administrator and enter the administrator login credentials.
  2. On the left pane, expand SERVER SETTINGS and select Java and JVM.
  3. To the ColdFusion Class Path, add the path to the StarSQL_JDBC.jar and StarLicense.properties files (e.g. "C:\Program Files\StarQuest\StarSQL_Java"). Click Submit Changes.
  4. Restart the ColdFusion Application Server service via Windows Services.
  5. Relaunch the ColdFusion Administrator and enter the administrator login credentials.
  6. On the left pane, expand DATA & SERVICES and select Data Sources.
  7. In the Add New Data Source section, enter a name (such as "DB2Prod") for the new ColdFusion data source, select other for the Driver, and click Add.
  8. Configure the data source properties as follows:
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 Guide PDF opens in new window for information about composing a JDBC URL using optional data source properties.

  1. Enter an optional description, set Advanced Settings (if desired), and click Submit.
  2. Once the connection has been added to the Connected Data Sources list, verify that the status of the data source is OK. If not OK, correct any errors reported and use the Verify button (icon with the green check mark) to test connectivity.

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>

Troubleshooting

If you encounter StarLicense licensing problems, refer to the technical note StarSQL for Java Licensing. It may be necessary to copy StarLicense.properties to the lib or ext directory of the JRE being used by ColdFusion (e.g. D:\ColdFusion9\runtime\jre\lib).


DISCLAIMER

The information in technical documents comes without any warranty or applicability for a specific purpose. 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 instructions may need to be modified to be appropriate for the hardware and software that has been installed and configured within a particular organization.  The information in technical documents should be considered only as an example and may include information from various sources, including IBM, Microsoft, and other organizations.