Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Connection to Oracle 11g via ODBC and PHP

2725044Nov 7 2014 — edited Nov 21 2014

Hi everyone,

I'm trying to connect to a Oracle 11g database with a PHP script, unfortunatly I can't use the OCI8 methods to connect so I'm trying with odb_connect function.


The script is the follow:

$db = "Driver={ODBC};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.xxx.xxx.xxx)(PORT=yyyy))(CONNECT_DATA=(SID=orcl)));Uid=username;Pwd=password;";

$username = 'username';

$password = 'password';

$connect = odbc_connect($db,$username,$password);

the output is False and I get this error "odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect..."

Probably the dsn string $db is wrong because I'm not sure about the right syntax.

Any help is useful. Thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2014
Added on Nov 7 2014
9 comments
5,036 views