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!
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.
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.
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.
You should use dblib
instead of sybase
, like this:
$dbh = new PDO("dblib:host=192.168.1.xxx;dbname=[database-name]", '[user]', '[pass]');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With