You can configure Oracle ColdFusion data sources for Windows NT and UNIX using ODBC and native drivers.
Note ColdFusion supports Oracle 7.3.4 and Oracle 8.0.4 and later. |
If you install ColdFusion Server Enterprise Edition on a Windows NT server, you can configure an Oracle data source using a native driver.
The following table describes ColdFusion native driver options for Oracle 7.3.4 and 8.0.x native driver data sources on Windows NT.
If you install ColdFusion Server Enterprise Edition on a Solaris server, you can configure an Oracle data source using a native driver.
The following table describes ColdFusion native driver options for Oracle 7.3.4 and 8.0.x native driver data sources on UNIX:
The following table describes ColdFusion ODBC driver options for the MERANT Oracle 7.3.4 and MERANT Oracle 8.0.x ODBC drivers on UNIX:
Before ColdFusion applications can connect to Oracle 7.3.4 and 8.0.x databases, you must install the Oracle client software.
You need to modify the /opt/coldfusion/bin/start script to include the ORACLE_HOME environment variable and add the $ORACLE_HOME/lib directory to the LD_LIBRARY_PATH. For an example, see "The /opt/coldfusion/bin/start script" on page 132. You must edit the $CFHOME/bin/start script for all versions. The environment variable LD_LIBRARY_PATH must point to the directory containing the libclntsh.so file, which ColdFusion uses.
If the libclntsh.so file was built in the $CFHOME/lib using a script that you downloaded from http://www.coldfusion.com, then the LD_LIBRARY_PATH variable should contain an entry for $CFHOME/lib prior to the entry for $ORACLE_HOME/lib, for example:
LD_LIBRARY_PATH = $CFHOME/lib:$ORACLE_HOME/lib:other_database_library_paths...
If the libclntsh.so file is in $ORACLE_HOME/lib, then you need just the single entry for this directory, for example:
LD_LIBRARY_PATH = $ORACLE_HOME/lib:other_database_library_paths...
Note The readme.ora file in $CFHOME/odbc/src/oracle incorrectly refers to $CFHOME as $ODBC_HOME. |
This is an example of a tnsnames.ora file:
scup=
(DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=scup) (PORT=1521)) (CONNECT_DATA=(SID=WG73)))
The following table describes the code:
When you complete all the steps in this section, you must stop and restart ColdFusion services to reload the odbc.ini file.
#!/bin/sh
# start - setup environment and run ColdFusion servers # This script should be run as root.# Set during install CFHOME=/opt/coldfusion # Sybase Open Client directory SYBASE=/work/sybclient11.1 # Oracle SQL *Net RDBMS directory # See CFHOME/odbc/src/oracle for script to build library ORACLE_HOME=/opt/oracle7 # Set library search path # # NOTE: Add your database client library directory to the FRONT of this list # # Example: LD_LIBRARY_PATH=$ORACLE_HOME/lib:$SYBASE/lib:/usr/dt/lib:/lib:/usr/openwin/lib:$CFHOME/lib # This is the list of variables that ColdFusion will see # Add any special Database environment varaibles here VAR_LIST="LD_LIBRARY_PATH CFHOME SYBASE ORACLE_HOME INFORMIXDIR INFORMIXSERVER II_SYSTEM" #========================================================== # You should not need to touch anything below this point #==========================================================
The environment variables CFHOME and ORACLE_HOME are assumed to point to the ColdFusion installation directory (usually /opt/coldfusion) and the Oracle Client Software installation directory (for example, /opt/oracle8).
Use the genclntsh script provided by Oracle in the $ORACLE_HOME/rdbms/lib directory and follow the Oracle instructions to build the libclntsh.so library in the $ORACLE_HOME/lib directory.
If ColdFusion cannot establish a connection to the Oracle 7.3.4 driver, try the following workarounds:
If the basic information that you entered in the Oracle Net8 Easy Config is correct, but the connection test fails, then seek assistance from your Oracle 8 database administrator (DBA). You should first check the basic connection information: hostname, SID, username, and password. You can do this using the Net8 Easy Config utility or by directly inspecting the tnsnames.ora file.
In addition, on UNIX, make sure that you defined the Oracle client library and ORACLE_HOME in the coldfusion/bin/start script.
Note ColdFusion supports Oracle 8.0.4 and later. |
For example:
CFHOME=/opt/coldfusion;export CFHOME
ORACLE_HOME=/opt/oracle8;export ORACLE_HOME
LD_LIBRARY_PATH=/lib:/usr/dt/lib:/usr/openwin/lib:$CFHOME/lib:$ORACLE_HOME/lib;export LD_LIBRARY_PATH
The script generates a new libclntsh.so in CFHOME; move it to $CFHome/lib.
Note Oracle 8 users have the original libclntsh.so library in the $ORACLE_HOME/lib directory. Therefore when creating the LD_LIBRAY_PATH in the $CFHOME/bin/start script, the $CFHOME/lib directory, containing the correct library, must be on the LD_LIBRARY_PATH before $ORACLE_HOME/lib. Otherwise, the original Oracle version loads, resulting in an error. |
When using the Oracle 7.3.4 native driver on Win32 systems, you might get the following error:
Error Diagnostic Information Oracle Error Code = 0 Internal error: The data access manager failed to initialize the Oracle environment.
The error occurred while processing an element with a general identifier of (cfquery), occupying document position (3:1) to (3:50).
This problem might occur with the Oracle 7.3.4 native driver in several situations:
cfquery
.This section includes the typical configuration steps that you need to use the Oracle 8 native database driver on UNIX or Windows NT. The following procedures were written using version 8.0.4.0.0 of the Oracle 8 Client.
Before you get started, make sure you have the following information handy:
You can find the UNIX version of this utility in $ORACLE_HOME/bin/net8wiz.sh.
The following procedure creates a database alias that you use to reference the Oracle database when creating the data source in the ColdFusion Administrator. When you create the database alias, the process writes all of the database connection information to a configuration file called tnsnames.ora.
On servers running Windows NT, the icon is found in your Oracle for Windows NT program group. On UNIX, this utility is found in $ORACLE_HOME/bin/net8wiz.sh.
The default is ORCL, but your database SID might be different. For this information, see your DBA.
To test the connection to the Oracle database, enter a valid username and password for accessing the Oracle database. If you do not have this information, see your DBA.
Now you need to create the data source in ColdFusion.
You might want to avoid setting a username and password here for security reasons. If you do not set a name and password, each CFML database call must specifically define a username and password.