Home » Developer & Programmer » Precompilers, OCI & OCCI » Can OCI Program avoid relink during different version of oracle on unix?
Can OCI Program avoid relink during different version of oracle on unix? [message #121324] Fri, 27 May 2005 10:42 Go to next message
Messages: 44
Registered: March 2005
Location: China


I am writing program in solaris using OCI, we have both oracle 8i and oracle 9i database, but I don't want to generate two version of my program, one for 8i and one for 9i, it works well in windows when I switch to different version between 8i/9i/10g, while on solaris, I must relink it, is there any way to avoid the relink between different version of oracle?

Re: Can OCI Program avoid relink during different version of oracle on unix? [message #121421 is a reply to message #121324] Sat, 28 May 2005 15:26 Go to previous message
Michael Hartley
Messages: 110
Registered: December 2004
Location: West Yorkshire, United Ki...
Senior Member


set your Oracle Home to the 9i installation and link you application to the 9i Oracle libraries.

Edit $ORACLE_HOME/network/admin/tnsnames.ora and create an entry for the 8i database and an entry for the 9i database and an entry for the 10g database.

eg. create tns aliases db8i, db9i, db10g using the following tns entry as an example

then confirm you have correctly created the tns entries

sqlplus un/pw@db8i
sqlplus un/pw@db9i
sqlplus un/pw@db10g

providing you have been able to sqlplus onto each of your databases.

modify your application to read the connection details either from the command line or from a configuration file. I would recommend you read from a configuration file and any users on the Unix system can list the active processes and see your passwords. ( ps -ef | grep <yourappname> )

Within the application modify the connection details to include the dbname eg.
sword OCILogon ( OCIEnv *envhp,
OCIError *errhp,
OCISvcCtx **svchp,
CONST OraText *username,
ub4 uname_len,
CONST OraText *password,
ub4 passwd_len,
CONST OraText *dbname,
ub4 dbname_len );

where you have loaded the username &username,
password in &password
and tns alias into &dbnamme.

Kind regards,
Michael Hartley, http://www.openfieldsolutions.co.uk
Previous Topic: Pro*c exe creation
Next Topic: Error en Cursor con select anidados
Goto Forum:

Current Time: Wed Feb 21 02:27:19 CST 2024