Skip to content
Advertisement

Create a DSN for the function odbc_connect for Oracle

The information I have concerning the Oracle database O need to connect to using PHP through EasyPHP is the following: user, password, host, port, service. I’m new to ODBC. I tried to use the function odbc_connect, but I keep getting errors simply because I don’t know how to make a DSN.

I tried using this:

$dns_db="DRIVER={DataDirect 32-BIT SequeLink 5.4};HOST=localhost; PORT=2399;ServerDataSource=maDB;"

But I don’t know what {DataDirect 32-BIT SequeLink 5.4} means, and it seems like I need to know the database name so I can put it in the ServerDataSource.

How do I make this DSN thing?

Advertisement

Answer

That should be the driver name as it shows up in the ODBC manager. In my computer I have Microsoft ODBC for Oracle and Oracle in instantclient_11_2 to choose from:

enter image description here

Try to use a driver provided by Oracle; the Microsoft one lacks many basic features.

But I’d recommend you to create a system ODBC so you can assign a name of your choice and simply refer to it by such name. Additionally, that allows to configure additional options with the driver’s GUI:

enter image description here

Last but not least, my final advice is to dump ODBC completely and use the OCI extension. Coding a PHP app with ODBC is frustrating.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement