How to Install Oracle 11.2 ODBC driver on Solaris
- Download and install (from the oracle website):
- Instant Client Package – Basic: All files required to run OCI, OCCI, and JDBC-OCI applications; instantclient-basic-solaris.sparc32-11.2.0.3.0.zip
- Instant Client Package – ODBC: Additional libraries for enabling ODBC applications ; instantclient-odbc-solaris.sparc32-11.2.0.3.0.zip
- Instant Client Package – SQL*Plus: Additional libraries and executable for running SQL*Plus with Instant Client ;instantclient-sqlplus-solaris.sparc32-11.2.0.3.0.zip
- Create the file /oracle/OracleClient11/instantclient_11_2/sqlnet.ora
(usertest@myserver)/oracle/OracleClient11/instantclient_11_2->cat sqlnet.ora
# Every line that begins with # is a comment line
# You can modify the entry below for your own database.
# sqlnet.ora Network Configuration File
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) - Create the file /oracle/OracleClient11/instantclient_11_2/tnsnames.ora
(usertest@myserver)/oracle/OracleClient11/instantclient_11_2->cat tnsnames.ora
MyDBServer_DSN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = MyDBServer)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = MyServiceName)
)
) - Set the following environment variables:
(usertest@myserver)/oracle/OracleClient11/instantclient_11_2->echo $TNS_ADMIN
/oracle/OracleClient11/instantClient_11_2
(usertest@myserver)/oracle/OracleClient11/instantclient_11_2->echo $ORACLE_HOME
/oracle/OracleClient11/instantClient_11_2
(usertest@myserver) /oracle/OracleClient11/instantclient_11_2->echo $SQLPATH
/oracle/OracleClient11/instantClient_11_2
(usertest@myserver)/ /oracle/OracleClient11/instantclient_11_2->echo $LD_LIBRARY_PATH
/oracle/OracleClient11/instantclient_11_2: $LD_LIBRARY_PATH
The Oracle instructions said to run “odbc_update_ini.sh” with “Driver Manager installed directory as a command line argument.” Is that part necessary? If so, how do I find the location of that directory? It does not seem to exist on this box.
Tony
Hi Tony,
That part is only necessary if you do not manually manage the .odbc.ini file; I personally prefer to manually manage the .odbc.ini and odbcinst.ini files. So, I did not need to execute the odbc_update_ini.sh.
But, if you need it, it should be in the folder $TNS_ADMIN (/oracle/OracleClient11/instantClient_11_2).
Here is a copy of the odbc_update_ini.sh file (Disclaimer: The following code belong to Oracle):
#!/bin/sh
#
# $Header: odbc/utl/odbc_update_ini.sh /main/9 2009/04/29 07:52:55 ksowmya Exp $
#
# odbc_update_ini.sh
#
# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
#
# NAME
# odbc_update_ini.sh
# – updates /etc/odbcinst.ini and ~/.odbc.ini
#
# DESCRIPTION
# Usage: odbc_update_ini.sh
# [] [Driver-name>] []
# The script should be run from the directory where ODBC driver .so is
# available if installation location is not passed as arg-2.
#
# NOTES
#
#
# MODIFIED (MM/DD/YY)
# ksowmya 04/14/09 – Bug[7704827]Support for ‘UseOCIDescribeAny’ flag in
# odbc.ini
# akapila 04/17/08 – modified for bug-6915027.
# akapila 09/03/07 – modified for bug-6374802.
# akapila 11/09/06 – modified for bug-5348587.
# akapila 05/17/06 –
# ardesai 11/23/05 –
# ardesai 11/23/05 –
# ardesai 11/23/05 –
# ardesai 11/23/05 –
# akapila 03/06/06 – modified for bug-4150034.
# akapila 09/26/05 – modified for bug4608183.
# subanerj 09/16/05 – Fixed bug 4557506. Added optional arguments.
# ardesai 05/31/05 – ardesai_bug-4397895
# ardesai 05/28/05 – Creation
#
# =========================================================================
# ODBCDM_HOME needs to be passed as arg-1
if [ ! “$1″ ]
then
echo ” *** Please pass ODBCDM_HOME as arg-1, and optional arguments -”
echo ” *** Install location (arg-2), Driver name (arg-3) & DSN (arg-4).”
echo ” *** Usage: odbc_update_ini.sh [] [] []”
exit
else
ODBCDM_HOME=”$1″
Fi
# Check whether Driver Manager is installed or not
if [ ! -f $ODBCDM_HOME/etc/odbc.ini -o ! -f $ODBCDM_HOME/etc/odbcinst.ini ]
then
echo ” *** INI file not found. Driver Manager not installed!”
exit
fi
# Add driver entry in $ODBCDM_HOME/etc/odbcinst.ini file
#
DRIVER_DESCRIPTION=”Oracle ODBC driver for Oracle 11g”
# If a driver location is passed, use that or use the current directory
if [ ! “$2″ ]
then
DRIVER_LOCATION=`pwd`
else
DRIVER_LOCATION=”$2”
fi
# Check for Driver name
if [ ! “$3″ ]
then
DRIVER_NAME=”Oracle 11g ODBC driver”
else
DRIVER_NAME=”$3″
fi
# We know driver .so name
SO_NAME=libsqora.so.11.1
echo ”
[$DRIVER_NAME]
Description = $DRIVER_DESCRIPTION
Driver = $DRIVER_LOCATION/$SO_NAME
Setup =
FileUsage =
CPTimeout =
CPReuse = ” >> $ODBCDM_HOME/etc/odbcinst.ini
# Add DSN entry
# If a DSN name is passed, use that or use the default name
if [ ! “$4″ ]
then
DSN=”OracleODBC-11g”
else
DSN=”$4″
fi
echo ”
[$DSN]
Application Attributes = T
Attributes = W
BatchAutocommitMode = IfAllSuccessful
BindAsFLOAT = F
CloseCursor = F
DisableDPM = F
DisableMTS = T
Driver = $DRIVER_NAME
DSN = $DSN
EXECSchemaOpt =
EXECSyntax = T
Failover = T
FailoverDelay = 10
FailoverRetryCount = 10
FetchBufferSize = 64000
ForceWCHAR = F
Lobs = T
Longs = T
MaxLargeData = 0
MetadataIdDefault = F
QueryTimeout = T
ResultSets = T
ServerName =
SQLGetData extensions = F
Translation DLL =
Translation Option = 0
DisableRULEHint = T
UserID =
StatementCache=F
CacheBufferSize=20
UseOCIDescribeAny=F
” >> $HOME/.odbc.ini
# Add DSN entry in “ODBC Data Sources” list
#
cat $HOME/.odbc.ini | sed “s/\[ODBC Data Sources\]/\[ODBC Data Sources\]\n$DSN = $DRIVER_DESCRIPTION/g” > odbc.ini
mv odbc.ini $HOME/.odbc.ini
Nice article. There are lots of other ODBC resources here that you might also find interesting.