NOTES ON CONNECTING RDBC TO ORACLE USING EASYSOFT OPEN SOURCE ORACLE ODBC DRIVER Last updated Feb 5 2004 SCROLL TO BOTTOM FOR "QUICK CONNECT INSTRUCTIONS" The updated and corrected version of these will reside at http://home.fnal.gov/~dbox/minos/oracle_odbc.notes archive versions will live at http://home.fnal.gov/~dbox/minos/oracle_odbc.notes.old please feel free to direct questions or corrections to dbox@fnal.gov Oracle Minos Development Server -------------------------------- Oracle development database on dba64.fnal.gov, Oracle 9.2.0.6.0 on 64 bit linux SID for oracle dev database is minosdev A snapshot of minos-db1.fnal.gov was last loaded onto minosdev on Mar 11 2005. DBMauto/dbmjob/cron were set to run replication from minos-db1.fnal.gov and seem to be running correctly. To connect to oracle database on odets2 (assuming environment correctly set): sqlplus minos_reader/reader@minosdev Setting Up Environment - Oracle ------------------------------- % setup oracle_client (you may have to upd install oracle_client v8_1_7 first) to check that oracle_client knows about minosdev database: grep -i minos $TNS_ADMIN/tnsnames.ora # Describe: Added minosdev instance and new cdfval1 instance minosdev.fnal.gov = (SID = minosdev) (GLOBAL_NAME = minosdev.fnal.gov) minosdev = (SID = minosdev) (GLOBAL_NAME = minosdev.fnal.gov) If these lines dont show up in the grep: % upd install oracle_tnsnames v39 % ups declare -c oracle_tnsnames v39 Now sqlplus described above should connect Setting Up Environment - Oracle ODBC Driver ------------------------------------------- liboraodbc.so and liboraodbcS.so need to be in LD_LIBRARY_PATH. these should eventually be in MINOS_EXTERNAL libraries. 1) Probably easiest way to do this: get them from /afs/fnal/files/home/room2/dbox//odbc/install/lib/ 2) Or, build them according to instructions at: http://fndapl.fnal.gov/~dbox/oracle/odbc/ Connecting an RDBC Program Using Oracle ODBC Driver -------------------------------------------------- Use these environment variables, along with LD_LIBRARY_PATH addition mentioned above ENV_TSQL_URL='oracle:odbc:oraodbc://dba64.fnal.gov:1521/minosdev' ENV_TSQL_USER=minos_reader ENV_TSQL_PSWD=reader ==================================== QUICK CONNECT INSTRUCTIONS ==================================== #run all the examples in the loon tutorial directory under Oracle #using the dev database copy of minos-db1-offline #!/bin/sh -x #setup minos environment . /afs/fnal.gov/files/code/e875/general/minossoft/setup/setup_minossoft_FNALU.sh #put oracle client libs in LD_LIBRARY_PATH setup oracle_client #minos-oracle specific environment vars export ENV_TSQL_URL='oracle:odbc:oraodbc://dba64.fnal.gov:1521/minosdev' export ENV_TSQL_USER=minos_reader export ENV_TSQL_PSWD=reader #run them all! for FILE in `ls $MINOS_TUTORIAL_MACROS/*.C` ; do OUT=`basename $FILE `; loon -qb $FILE $MINOS_TUTORIAL_DATA/F00018143_0000.mdaq.root 2>>$OUT.oracle 1>>$OUT.oracle done;