简体   繁体   中英

No ODBC database schema in Yii?

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.

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.

I've used the non open source driver from easysoft and it worked allright.

I also used another workaround, which was installing the yii stack on the windows server machine, and just use the Microsoft's MSSQL Php Driver, I last saw it here . After that you can use

'db'=>array(
    'connectionString' => 'sqlsrv:server=(local)\SQLEXPRESS ; Database=mydb',
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM