Thursday, March 1, 2018

Laravel 5.5 SQLSTATE[HYT00]: [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired - development

Laravel 5.5 SQLSTATE[HYT00]: [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired

i’m trying to connect to a sql server (IIS) from Centos 7.4 with my Laravel 5.5 app running php 7.0 but after few seconds the request returns this error: “SQLSTATE[HYT00]: [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired

In local enviroment (Windows) work great, but not in production.

This is my config/database.php

'sqlsrv_triviaOld' => [
            'driver' => 'sqlsrv',
            'host' => env('DB_HOST_TRIVIAOLD', 'localhost'),
            'port' => env('DB_PORT_TRIVIAOLD', '1433'),
            'database' => env('DB_DATABASE_TRIVIAOLD', 'forge'),
            'username' => env('DB_USERNAME_TRIVIAOLD', 'forge'),
            'password' => env('DB_PASSWORD_TRIVIAOLD', ''),
            'charset' => 'utf8',
            'prefix' => '',
        ],

This is my .env file:

DB_CONNECTION_TRIVIAOLD=sqlsrv
DB_HOST_TRIVIAOLD=190.216.31.196
DB_PORT_TRIVIAOLD=1433
DB_DATABASE_TRIVIAOLD=databasename
DB_USERNAME_TRIVIAOLD=username
DB_PASSWORD_TRIVIAOLD=psw

i’ve all (maybe at this point!) all the php extensions needed in order for this to work.

This is my phpinfo():

enter image description here

This is a query expemple i’m using:

$norms = DB::connection('sqlsrv_triviaOld')->table('normas')
        ->where('id_tipo_norma', '=', $request->id_tipo_norma)
        ->where('id_norma', '=', $request->id_norma)
        ->first();

Any idea of how to solve this? i’m getting crazy!

Thanks to everyone!



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-5-5-sqlstatehyt00-unixodbcmicrosoftodbc-driver-13-for-sql-serverlogin-timeout-expired/
via Lzo Media

No comments:

Post a Comment