dbTalk Databases Forums  

PHP+Oracle: could not resolve service name

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss PHP+Oracle: could not resolve service name in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default PHP+Oracle: could not resolve service name - 04-09-2008 , 06:35 AM






I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience doesn't
got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2 +
PHP module running as LocalSystem) and I've found no problems using TOAD.
Apart from environment, PHP configuration is identical in command line and
web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you have
any clue?

Sample code:

<?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?>



Reply With Quote
  #2  
Old   
Shakespeare
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 02:34 PM







"Álvaro G. Vicario" <alvaro_NOSPAM (AT) demogracia (DOT) com> schreef in bericht
news:fti9n3$v56$1 (AT) huron (DOT) algomas.org...
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience
doesn't got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in
SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2
+ PHP module running as LocalSystem) and I've found no problems using
TOAD. Apart from environment, PHP configuration is identical in command
line and web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you
have any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?

What did you set TNS_ADMIN to? Where is your TNSNAMES.ORA?

Shakespeare




Reply With Quote
  #3  
Old   
Shakespeare
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 02:34 PM




"Álvaro G. Vicario" <alvaro_NOSPAM (AT) demogracia (DOT) com> schreef in bericht
news:fti9n3$v56$1 (AT) huron (DOT) algomas.org...
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience
doesn't got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in
SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2
+ PHP module running as LocalSystem) and I've found no problems using
TOAD. Apart from environment, PHP configuration is identical in command
line and web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you
have any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?

What did you set TNS_ADMIN to? Where is your TNSNAMES.ORA?

Shakespeare




Reply With Quote
  #4  
Old   
Shakespeare
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 02:34 PM




"Álvaro G. Vicario" <alvaro_NOSPAM (AT) demogracia (DOT) com> schreef in bericht
news:fti9n3$v56$1 (AT) huron (DOT) algomas.org...
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience
doesn't got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in
SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2
+ PHP module running as LocalSystem) and I've found no problems using
TOAD. Apart from environment, PHP configuration is identical in command
line and web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you
have any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?

What did you set TNS_ADMIN to? Where is your TNSNAMES.ORA?

Shakespeare




Reply With Quote
  #5  
Old   
Shakespeare
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 02:34 PM




"Álvaro G. Vicario" <alvaro_NOSPAM (AT) demogracia (DOT) com> schreef in bericht
news:fti9n3$v56$1 (AT) huron (DOT) algomas.org...
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience
doesn't got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in
SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2
+ PHP module running as LocalSystem) and I've found no problems using
TOAD. Apart from environment, PHP configuration is identical in command
line and web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you
have any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?

What did you set TNS_ADMIN to? Where is your TNSNAMES.ORA?

Shakespeare




Reply With Quote
  #6  
Old   
Michael Austin
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 04:13 PM



Álvaro G. Vicario wrote:
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience doesn't
got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2 +
PHP module running as LocalSystem) and I've found no problems using TOAD.
Apart from environment, PHP configuration is identical in command line and
web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you have
any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?



you still need to add an entry in your tnsnames.ora file (generally
located in the oracle home under network\admin.

A google search will give you many examples of how to create a tnsnames
entry.


Reply With Quote
  #7  
Old   
Michael Austin
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 04:13 PM



Álvaro G. Vicario wrote:
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience doesn't
got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2 +
PHP module running as LocalSystem) and I've found no problems using TOAD.
Apart from environment, PHP configuration is identical in command line and
web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you have
any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?



you still need to add an entry in your tnsnames.ora file (generally
located in the oracle home under network\admin.

A google search will give you many examples of how to create a tnsnames
entry.


Reply With Quote
  #8  
Old   
Michael Austin
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 04:13 PM



Álvaro G. Vicario wrote:
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience doesn't
got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2 +
PHP module running as LocalSystem) and I've found no problems using TOAD.
Apart from environment, PHP configuration is identical in command line and
web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you have
any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?



you still need to add an entry in your tnsnames.ora file (generally
located in the oracle home under network\admin.

A google search will give you many examples of how to create a tnsnames
entry.


Reply With Quote
  #9  
Old   
Michael Austin
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 04:13 PM



Álvaro G. Vicario wrote:
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience doesn't
got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in SQLConnect

Which translates into English as "could not resolve service name".

The *very same code* runs fine when parsed through the web server (Apache2 +
PHP module running as LocalSystem) and I've found no problems using TOAD.
Apart from environment, PHP configuration is identical in command line and
web.

After some Googling I've tried setting TNS_ADMIN and ORACLE_HOME
environmental variables but it didn't make any difference. I just can't
understand why all programs can connect except command line PHP. Do you have
any clue?

Sample code:

?php

define('DB_DSN', 'FOO');
define('DB_USERNAME', 'FOO');
define('DB_PASSWORD', 'FOO');

odbc_connect(DB_DSN, DB_USERNAME, DB_PASSWORD);

?



you still need to add an entry in your tnsnames.ora file (generally
located in the oracle home under network\admin.

A google search will give you many examples of how to create a tnsnames
entry.


Reply With Quote
  #10  
Old   
joel garry
 
Posts: n/a

Default Re: PHP+Oracle: could not resolve service name - 04-09-2008 , 04:22 PM



On Apr 9, 4:35*am, "Álvaro G. Vicario" <alvaro_NOS... (AT) demogracia (DOT) com>
wrote:
Quote:
I'm developing a PHP 4 application in a Windows Server 2003 box. I'm
connecting to a remote Oracle 10g server using ODBC (with a system-wide
DSN). I didn't install any of the software and my Oracle experience doesn't
got further than writing queries ;-)

My issue is that PHP scripts cannot connect to the database server when I
run them from the *command line*. I get this error message:

* * SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:no
se ha podido resolver el nombre del servicio, SQL state 08001 in SQLConnect

Try http://www.oracle.com/technology/pub...p_instant.html

jg
--
@home.com is bogus.
Oops! http://www.computerworld.com.au/index.php/id;314715708


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.