OCI8

I have some trouble with Oracle Database and php...

see this code:
<?
while (1) {
$conn=OCILogon($username,$password,$database);
$stmt=OCIParse($conn,"select 50 as toto from dual");
OCIDefineByName($stmt,"TOTO",&$total);
OCIExecute($stmt);
OCIFetch($stmt);
echo ":::$total:::\n";
OCILogoff($conn);
$err=OCIError($conn);
OCILogoff($conn);
sleep(10);
}
?>

when i execute it, the number of fd on ocius.msg is growing. but there is
only 1 connection at database.

Can someone help me ?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Yannick GUENET [ Fr, 13 August 2004 14:29 ] [ ID #265360 ]

Re: OCI8

It might be a feature of PHP's connection caching. Why don't
you log a bug in the PHP bug DB so the problem can be tracked?

Do you really need to keep reconnecting?
See http://www.oracle.com/technology/tech/opensource/php/php_tro ubleshooting_faq.html#conmgt

Chris


yannick wrote:

> I have some trouble with Oracle Database and php...
>
> see this code:
> <?
> while (1) {
> $conn=OCILogon($username,$password,$database);
> $stmt=OCIParse($conn,"select 50 as toto from dual");
> OCIDefineByName($stmt,"TOTO",&$total);
> OCIExecute($stmt);
> OCIFetch($stmt);
> echo ":::$total:::\n";
> OCILogoff($conn);
> $err=OCIError($conn);
> OCILogoff($conn);
> sleep(10);
> }
> ?>
>
> when i execute it, the number of fd on ocius.msg is growing. but there is
> only 1 connection at database.
>
> Can someone help me ?
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Christopher Jones [ Fr, 13 August 2004 15:12 ] [ ID #265361 ]

RE: OCI8

i don t really need to keep reconnecting.

i made this script to reproduce problem with apache.

ie:apache's child keep a lot of Fd to ocius.msg .


-----Message d'origine-----
De : Christopher Jones [mailto:christopher.jones [at] oracle.com]
Envoye : vendredi 13 aout 2004 15:12
A : yannick
Cc : php-db [at] lists.php.net
Objet : Re: [PHP-DB] OCI8



It might be a feature of PHP's connection caching. Why don't
you log a bug in the PHP bug DB so the problem can be tracked?

Do you really need to keep reconnecting?
See
http://www.oracle.com/technology/tech/opensource/php/php_tro ubleshooting_faq
..html#conmgt

Chris


yannick wrote:

> I have some trouble with Oracle Database and php...
>
> see this code:
> <?
> while (1) {
> $conn=OCILogon($username,$password,$database);
> $stmt=OCIParse($conn,"select 50 as toto from dual");
> OCIDefineByName($stmt,"TOTO",&$total);
> OCIExecute($stmt);
> OCIFetch($stmt);
> echo ":::$total:::\n";
> OCILogoff($conn);
> $err=OCIError($conn);
> OCILogoff($conn);
> sleep(10);
> }
> ?>
>
> when i execute it, the number of fd on ocius.msg is growing. but there is
> only 1 connection at database.
>
> Can someone help me ?
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Yannick GUENET [ Fr, 13 August 2004 15:18 ] [ ID #265363 ]

RE: OCI8

On 13 August 2004 13:29, yannick wrote:

> I have some trouble with Oracle Database and php...
>
> see this code:
> <?
> while (1) {
> $conn=OCILogon($username,$password,$database);

Try OCIPLogon() rather than OCILogon().

> $stmt=OCIParse($conn,"select 50 as toto from dual");
> OCIDefineByName($stmt,"TOTO",&$total);

Not related to your problem, but you don't need that & -- in fact, it's deprecated and may, one day, cause a parse error.

> OCIExecute($stmt);
> OCIFetch($stmt);
> echo ":::$total:::\n";
> OCILogoff($conn);
> $err=OCIError($conn);
> OCILogoff($conn);
> sleep(10);
> }
> >
>
> when i execute it, the number of fd on ocius.msg is growing. but
> there is only 1 connection at database.
>
> Can someone help me ?

Cheers!

Mike

------------------------------------------------------------ ---------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford [at] leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
M.Ford [ Fr, 13 August 2004 16:03 ] [ ID #265365 ]

RE: OCI8

Thanks for your help, but i tried with OCIPLogon, and get same result.


-----Message d'origine-----
De : Ford, Mike [LSS] [mailto:M.Ford [at] leedsmet.ac.uk]
Envoyé : vendredi 13 août 2004 16:03
À : 'yannick'; php-db [at] lists.php.net
Objet : RE: [PHP-DB] OCI8


On 13 August 2004 13:29, yannick wrote:

> I have some trouble with Oracle Database and php...
>
> see this code:
> <?
> while (1) {
> $conn=OCILogon($username,$password,$database);

Try OCIPLogon() rather than OCILogon().

> $stmt=OCIParse($conn,"select 50 as toto from dual");
> OCIDefineByName($stmt,"TOTO",&$total);

Not related to your problem, but you don't need that & -- in fact, it's
deprecated and may, one day, cause a parse error.

> OCIExecute($stmt);
> OCIFetch($stmt);
> echo ":::$total:::\n";
> OCILogoff($conn);
> $err=OCIError($conn);
> OCILogoff($conn);
> sleep(10);
> }
> >
>
> when i execute it, the number of fd on ocius.msg is growing. but
> there is only 1 connection at database.
>
> Can someone help me ?

Cheers!

Mike

------------------------------------------------------------ ---------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford [at] leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Yannick GUENET [ Fr, 13 August 2004 16:40 ] [ ID #265367 ]

Re: oci8

Hi Fred,

pecl-dev [at] lists.php.net is a development mail list. The best place to
post to is php-db [at] lists.php.net. I'm ccing that list: please remove
pecl-dev from any followup mail.

Fred Silsbee wrote:
> I have Fedora 9 2.6.27.5-37.fc9.i686 and Oracle 11g1

> oracle [at] LMKIII oci8-1.3.4$ phpize also tried phpize.php
> bash: phpize: command not found

I know on Redhat EL you need the php-pear and php-devel RPMs to get
pecl, pear and phpize.

> the README says to run ,/configure but there is only config.m4 and
> config.w32

phpize creates configure.

> I am trying to get a PHP connection to Oracle 11g1
>
> <?php
>
> if ($c = oci_connect('hr','hr','//localhost/lmkiiiGDNSID')) {
>
> echo "Successfully connected to Oracle.\n";
>
> OCILogoff($c);
>
> } else {
>
> $err = OCIError();
>
> echo "Oracle Connect Error " . $errtext;
>
> }
>
> ?>
> I get no errors just doesn't work!

Given the previous build failures it's unlikely this code will run.

If you haven't set display_errors to On in php.ini you won't see any
automatic PHP errors.

Also, your error printing code should look like:

echo "Oracle Connect Error " . $err['message]';

For information on OCI8 there are a number of books available,
including my free PDF book at http://tinyurl.com/f8jad. (A new
version of this book should be out in the next week or so: I've just
finished my edits on it.)

Chris

--
Email: christopher.jones [at] oracle.com Tel: +1 650 506 8630
Twitter: http://twitter.com/ghrd Free PHP Book: http://tinyurl.com/f8jad
Christopher Jones [ Mo, 17 November 2008 00:41 ] [ ID #1977405 ]
PHP » gmane.comp.php.database » OCI8

Vorheriges Thema: trying to get pecl and phpize to build oci8
Nächstes Thema: PostgreSQL pg_query_params, PHP locales, and double data types