dongliao1948 2017-07-19 16:48
浏览 118

使用Doctrine pdo_sqlsrv连接到数据库

I'm trying to connect to my database in SQL Server 2000, but i get an error

could not find driver

when i'm using pdo_sqlsrv. But if i use sqlsrv i get an error

Attempted to call function "sqlsrv_configure" from namespace "Doctrine\DBAL\Driver\SQLSrv".

Here is my config.yml

config.yml

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                dbname: "%database_name%"
                user: "%database_user%"
                password: "%database_password%"
                host: "%database_host%"
                driver:   pdo_mysql
                charset:  utf8mb4
                default_table_options:
                    charset: utf8mb4
                    collate: utf8mb4_unicode_ci
            connection2:
                dbname: "%database_name2%"
                user: "%database_user2%"
                password: "%database_password2%"
                host: "%database_host2%"
                driver:  pdo_sqlsrv
                #driver:  sqlsrv  i've also tried this
                #charset:  utf8mb4
                default_table_options:
                    charset: utf8mb4
                    collate: utf8mb4_unicode_ci

Does anybody know why i'm getting these errors?

  • 写回答

2条回答 默认 最新

  • dsgdhf5674 2017-07-19 17:07
    关注

    Can you try:

    driver:        pdo_sqlsrv
    database_port: 1433
    

    Not sure if that will work, but try it.

    评论

报告相同问题?