Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to Sybase via PHP

Tags:

php

sybase

dbo

I'm trying to connect to a Sybase database with PHP5. I believe I've successfully compiled PHP with PDO_DBLIB, as phpinfo() lists dblib under PDO drivers, and freetds as the pdo_dblib flavour.

However, when I try to test a connection, I get an error reading:

'PDOException' with message 'could not find driver'

I'm trying to connect to a server on my LAN with this code:

$dbh = new PDO("sybase:host=192.168.1.xxx;dbname=[database-name]", '[user]', '[pass]');

Any suggestions would be greatly appreciated!

like image 279
zwiebelspaetzle Avatar asked Jan 18 '13 22:01

zwiebelspaetzle


People also ask

How connect PHP to Sybase?

To make a connection to a database, pass a standard SAP Sybase IQ connection string to the database server as a parameter to the sasql_connect function. The <? php and ?> tags tell the web server that it should let PHP execute the code that lies between them and replace it with the PHP output.

How do I connect to a Sybase database?

Use the Connect to Sybase dialog box to connect to the Sybase Adaptive Server Enterprise (ASE) instance that you want to migrate. To access this dialog box, on the File menu, select Connect to Sybase. If you have previously connected, the command is Reconnect to Sybase.

How do I connect to Sybase ASE?

To connect to Sybase ASEOn the File menu, select Connect to Sybase. If you previously connected to Sybase, the command name will be Reconnect to Sybase. In the Provider box, select any of the installed providers on the machine to connect to Sybase server.


1 Answers

You should use dblib instead of sybase, like this:

$dbh = new PDO("dblib:host=192.168.1.xxx;dbname=[database-name]", '[user]', '[pass]');
like image 143
gumaterror Avatar answered Sep 29 '22 03:09

gumaterror