Sunday, January 30, 2022

[FIXED] No ODBC database schema in Yii?

Issue

I'm looking at the source files for Yii 1.1.5, and I don't see a database schema for ODBC. When I use this connection string in my config file:

'db'=>array(
  'connectionString' => 'odbc:rhinestone',
  'username' => 'user',
  'password' => 'pass',
),

I get this error:

"CDbConnection does not support reading schema for ODBC database."

However, I can use that connection string in regular php and connect just fine:

$dbh= new PDO('odbc:rhinestone', 'user', 'pass');

So I know it's not an issue with my drivers or with PHP.

Why does Yii not support ODBC? Is this going to change? I'm trying to connect to MSSQL from a linux server and it seems like the pdo mssql and dblib drivers are either experimental or deprecated.

Does anyone have any advice on how to do this?

UPDATE: I've received a number of suggestions so far all making the assumptions that I'm running PHP on Windows. This is not the case. I'm running it on Linux, and I have to connect to a SQL Server database for a project.


Solution

The answer to this question is that, as of this writing, Yii does not have a schema for pdo_odbc. And as far as I can tell, they do not have plans to write one. If anyone hears otherwise, please let me know.



Answered By - Philip Walton

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.