分类: Oracle
2009-12-06 21:36:50
Download and install the Instant Client shared libraries and Oracle JDBC class libraries to a directory, such as instantclient.
Set the library path environment variable to the directory from step 1. For example, on UNIX, set LD_LIBRARY_PATH to instantclient. On Windows, set PATH to locate the instantclient directory.
Add the full pathnames of the JDBC class libraries to the CLASSPATH environment variable.(一般在应用服务器中的classpath环境中已经包含该jar文件,不需要在环境变量中单独设置这个classpath)
LD_LIBRARY_PATH environment variable to the instant client directory to operate in the Instant Client mode.On Linux or UNIX:
libociei.so library is in $ORACLE_HOME/instantclient
libclnstsh.so.10.1, libocijdbc10.so, and libnnz10.so are in $ORACLE_HOME/lib
The JDBC class libraries are in $ORACLE_HOME/jdbc/lib
On Windows:
oraociei10.dll library is in ORACLE_HOME\instantclient
oci.dll, oraocijdbc10.dll, and orannzsbb10.dll are in ORACLE_HOME\bin
The JDBC class libraries are in ORACLE_HOME\jdbc\lib
CLASSPATH, you can enable running the JDBC OCI application in the Instant Client mode.ORACLE_HOME/lib
and Instant Client directories in the library path environment variable
simultaneously, regardless of the order in which they appear in the
variable. That is, only one of ORACLE_HOME/lib
directory (for non-Instant Client operation) or Instant Client
directory (for Instant Client operation) should be specified in the
library path environment variable.tnsnames.ora
The connect string can also be stored in the tnsnames.ora file. For example, consider that the tnsnames.ora file contains the following:
conn_str = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server6)(PORT=1573))
(CONNECT_DATA=(SERVICE_NAME=rdbms3.server6.us.alchemy.com)))
TNS_ADMIN to locate configuration files continue to work if the TNS_ADMIN environment variable is set.TNS_ADMIN environment variable specifies the directory where the tnsnames.ora file is located. However, TNS_ADMIN does not specify the full path of the tnsnames.ora file, instead it specifies the directoryTNS_ADMIN environment variable is not set and TNSNAMES entries, such as inst1, are used, then the ORACLE_HOME environment variable must be set and the configuration files are expected to be in the $ORACLE_HOME/network/admin directory.TWO_TASK environment variable on UNIX, or the LOCAL variable on Windows, to either a tnsnames.ora entry or an Oracle Net keyword-value pair. TWO_TASK or LOCAL is set to a tnsnames.ora entry, then the tnsnames.ora file must be loaded by the TNS_ADMIN or ORACLE_HOME setting.setenv TWO_TASK conn_str
In the Instant Client mode, if the ORA_TZFILE variable is not set, then the smaller, default, timezone.dat file from the Data Shared Library is used. If the larger timezlrg.dat file is to be used from the Data Shared Library, then set the ORA_TZFILE environment variable to the name of the file without any absolute or relative path names. That is:
On UNIX:
setenv ORA_TZFILE timezlrg.dat
On Windows:
set ORA_TZFILE timezlrg.dat
在完整客户端情况下:
If the driver is not operating in the Instant Client mode, then theORA_TZFILEvariable, if set, names a complete path name, as it does in previous Oracle Database releases.