RE: [PHP-DB] Connection to Oracle Fails Sometimes

From: Date: Wed, 22 Nov 2000 07:59:05 +0000
Subject: RE: [PHP-DB] Connection to Oracle Fails Sometimes
Groups: php.db 
Request: Send a blank email to php-db+get-4641@lists.php.net to get a copy of this message
I set environment vars in php script, and it works sometimes but when i did several quick refresh the script failed to resolve service name. ERROR: ORA-12154: TNS:could not resolve service name Below is the php scripts that get some rows from emp table in oracle8.1.6 database. <? $user="scott"; $password="tiger"; putenv("ORACLE_SID=orauser"); putenv("ORACLE_HOME=/usr/local/oracle"); $connection =OCILogon($user,$password); $query = "select * from emp"; $statement = OCIParse($connection,$query); $ret = OCIExecute($statement); $col = OCIFetchinto($statement,&$row); while ($col) { echo " User name:".$row[1]; echo "<br>"; $col = OCIFetchinto($statement,&$row); } ?> -----Original Message----- From: Roberto Sartor [mailto:roberto@mionetto.it] Sent: Wednesday, November 22, 2000 2:31 PM To: 'Sugianto Halim'; php-db@lists.php.net Subject: R: [PHP-DB] Connection to Oracle Fails Sometimes Did you set environment vars in /etc/rc.d/init.d/httpd or /etc/rc.d/init.d/functions (for RedHat)? And TWO_TASK (almost for Oracle8,I'm not sure whether it's the same name for Oracle 8i)? Ciao Roberto > -----Messaggio originale----- > Da: Sugianto Halim [mailto:lim@srw.iao.co.id] > Inviato: mercoledì 22 novembre 2000 7.15 > A: php-db@lists.php.net > Oggetto: [PHP-DB] Connection to Oracle Fails Sometimes > > > Our scripts have to connect to a remote database. Sometimes it works > fine, sometimes oracle errors appear like: > > "Could not resolve service name" > > The enviroment (ORACLE_HOME, ORACLE_SID, ORA_NLS, NLS_LANG) and the > ora_logon command should > be alright, because sometimes the db connect works without any error! > what is happening here? > > System php is running on: > - linux Mandrake 7 > - apache 1.3.12 > - php 4.0.3pl1 configured with: > ./configure --with-apxs=/usr/local/www/bin/apxs > --with-oci8=/usr/local/oracle > - Oracle 8i Client 8.1.5.2 > > Oracle Server is running on : > - linux redhat 6.1 > - Oracle 8i Server 8.1.6 > > Most time it fails when i click F5 (refresh) too fast. I tested > tnsnames.ora with SQLPLUS > and it work fine, the problem only show up when I use OCILogon on PHP. > Is anyone have the > problem > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.db (#4641) next »