Support the ongoing development of Laravel.io →
Installation Configuration Database

Hi everyone,

i found a really strange problem using sqlsrv driver for connecting to the database. If i use as default DB_CONNECTION 'sqlsrv' with this configuration

'sqlsrv' => [
            'driver'   => 'sqlsrv',
            'host'     => 'MSSQL_TEST',
            'database' => 'dbname',
            'username' => 'dbuser',
            'password' => 'dbpassword',
            'charset'  => 'utf8',
            'prefix'   => '',
        ],

i get this error

[PDOException]                                                  
  SQLSTATE[01002] Adaptive Server connection failed (severity 9) 

if i use the exact same configuration using another DB_CONNECTION name such as 'test' i get this working with no error:

'test' => [
            'driver'   => 'sqlsrv',
            'host'     => 'MSSQL_TEST',
            'database' => 'dbname',
            'username' => 'dbuser',
            'password' => 'dbpassword',
            'charset'  => 'utf8',
            'prefix'   => '',
        ],

can anyone explain me why is this appening? i got really no clue about that.

Thanks in advance to anyone who could help me.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

itapingu itapingu Joined 14 Dec 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.