From: "Ryan Taylor" on
Hi,



I'm having trouble connecting to am oracle database using MDB2. I've
installed oci8 extension for PHP and think that is working. I've also
installed the MDB2_Driver_oci8.



I'm getting this message:



ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA



If I use this dsn :



oci8://USERNAME:***@MISSERVER.leeds-art.ac.uk/STUDENTS



And this message:



ORA-12514: TNS:listener does not currently know of service requested in
connect descriptor



If I use this dsn:



oci8://USERNAME:***@MISSERVER.leeds-art.ac.uk/?service=STUDENTS



Am I formatting the dsn wrongly? What is the correct format?



Thanks



Ryan

From: Lorenzo Alberton on
Ryan Taylor wrote:
> I'm having trouble connecting to am oracle database using MDB2. I've
> installed oci8 extension for PHP and think that is working. I've also
> installed the MDB2_Driver_oci8.


try with the array syntax, it's safer:

$dsn = array(
'phptype' => 'oci8',
'hostspec' => '//localhost/XE',
'username' => 'hr',
'password' => 'oracle',
//'hostspec' => '127.0.0.1:1521',
);

or

//oracle's "Easy Connect" syntax (Oracle 10g)
$dsn = array (
'phptype' => 'oci8',
'dbsyntax' => 'oci8',
'username' => 'XXXX',
'password' => 'YYY',
'protocol' => 'tcp',
'hostspec' => '//localhost/XE',
'service' => 'servicename',
'port' => false,
'socket' => false,
'database' => false,
'mode' => false,
);


HTH

Cheers,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 50 Mb, 150 Mb di spazio web e molto di pi�!
Registrati gratis: http://www.quipo.it

From: "Ryan Taylor" on
No, still can't connect.

You've got //localhost/XE in your example, how should my host be formatted?

Why is the array syntax safer btw?

-----Original Message-----
From: Lorenzo Alberton [mailto:l.alberton(a)quipo.it]
Sent: 26 September 2008 12:17
To: Ryan Taylor
Cc: pear-general(a)lists.php.net
Subject: [PEAR] Re: MDB2 with oci8 DSN

Ryan Taylor wrote:
> I'm having trouble connecting to am oracle database using MDB2. I've
> installed oci8 extension for PHP and think that is working. I've also
> installed the MDB2_Driver_oci8.


try with the array syntax, it's safer:

$dsn = array(
'phptype' => 'oci8',
'hostspec' => '//localhost/XE',
'username' => 'hr',
'password' => 'oracle',
//'hostspec' => '127.0.0.1:1521',
);

or

//oracle's "Easy Connect" syntax (Oracle 10g)
$dsn = array (
'phptype' => 'oci8',
'dbsyntax' => 'oci8',
'username' => 'XXXX',
'password' => 'YYY',
'protocol' => 'tcp',
'hostspec' => '//localhost/XE',
'service' => 'servicename',
'port' => false,
'socket' => false,
'database' => false,
'mode' => false,
);


HTH

Cheers,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 50 Mb, 150 Mb di spazio web e molto di più!
Registrati gratis: http://www.quipo.it


--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

From: Lorenzo Alberton on
Ryan Taylor wrote:
> No, still can't connect.

what error are you getting?

> You've got //localhost/XE in your example, how should my host be formatted?

oci8://username:password(a)foo.example.com[:port]/?service=service

try with

$dsn = array (
'phptype' => 'oci8',
'dbsyntax' => 'oci8',
'username' => 'USERNAME',
'password' => '***',
'hostspec' => 'MISSERVER.leeds-art.ac.uk',
'service' => 'STUDENTS',
);


> Why is the array syntax safer btw?

because it doesn't have to be parsed.
The string DSN will be converted into an array anyway,
so you can save a few CPU cycles if you already provide
the parameters in an array.

Cheers,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 50 Mb, 150 Mb di spazio web e molto di pi�!
Registrati gratis: http://www.quipo.it

From: "Ryan Taylor" on
I'm getting:

[Native message: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor]

Using that last example you sent.

Cheers

Ryan

-----Original Message-----
From: Lorenzo Alberton [mailto:l.alberton(a)quipo.it]
Sent: 26 September 2008 14:07
To: Ryan Taylor
Cc: pear-general(a)lists.php.net
Subject: Re: [PEAR] Re: MDB2 with oci8 DSN

Ryan Taylor wrote:
> No, still can't connect.

what error are you getting?

> You've got //localhost/XE in your example, how should my host be formatted?

oci8://username:password(a)foo.example.com[:port]/?service=service

try with

$dsn = array (
'phptype' => 'oci8',
'dbsyntax' => 'oci8',
'username' => 'USERNAME',
'password' => '***',
'hostspec' => 'MISSERVER.leeds-art.ac.uk',
'service' => 'STUDENTS',
);


> Why is the array syntax safer btw?

because it doesn't have to be parsed.
The string DSN will be converted into an array anyway,
so you can save a few CPU cycles if you already provide
the parameters in an array.

Cheers,
--
Lorenzo Alberton
http://pear.php.net/user/quipo
________________________________________________________________________
Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
canone, 2 e-mail da 50 Mb, 150 Mb di spazio web e molto di più!
Registrati gratis: http://www.quipo.it