Yii and Sybase iAnywhere

I am interested to know if anyone here has been successful connecting to Sybase databases with Yii. I am a consultant and I would very much like to encourage the use of Yii for one of my clients. Unfortunately, they make extensive use of Sybase databases and so will definitely not agree to use Yii if Sybase databases are not supported. I have looked in the forum and have not found any information about how to successfully connect to either a Sybase ASE database or a Sybase iAnywhere database. I am particularly interested in iAnywhere as that is the database I need to connect to, but if someone has experience with ASE and can detail the steps that they took to get connected then that would also help me.


There is no ready to use Sybase driver for Yii. Moreover, the only way to use Sybase from PHP PDO is experimental dblib PDO driver. So there are two problems:

  1. Find a good way to use Sybase from PHP’s PDO. If your client is using Sybase with PHP it’s probably solved.

  2. Write a driver for Yii schema (not really a hard task if you know Sybase well. Can be implemented and tested in about a week or so). You’ll need to implement something like what is located at /framework/db/schema/mssql.

Thanks for the reply and for the information, samdark.

Regarding problem 1, connecting to Sybase from PDO: I have never made use PHP’s PDO before for connecting to Sybase databases and have only used PHP’s odbc functions. But I am sure that it must also be possible to use PDO_ODBC to establish the connection. I will test this.

Regarding problem 2, I do have experience with working with meta-data in Sybase databases, so writing the Yii driver shouldn’t be a problem. I just don’t have any experience with Yii so if you could give a quick overview of where the connection settings specified in the config are used and where the driver that needs to be built is used, that would help a lot in getting me up to speed.


It’s described well in the guide:


but I don’t think you’ll really need it.

To implement schema driver you should check out code from http://code.google.com/p/yii/.

Existing drivers are unit-tested well (tests are located here: tests/unit/framework/db/schema) so you can create a test for Sybase and then implement a driver. Driver itself should be put into framework/db/schema.