0

I'm getting error: "SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)" when I try to get answer from server by

$users = DB::connection('sqlsrv')->select('Select quotation_username from users');

and yes - I have set:

 'sqlsrv' => [
        'driver' => 'sqlsrv',
        'host' => env('DB_HOST2', 'localhost'),
        'port' => env('DB_PORT2', '1433'),
        'database' => env('DB_DATABASE2', 'forge'),
        'username' => env('DB_USERNAME2', 'forge'),
        'password' => env('DB_PASSWORD2', ''),
        'charset' => 'utf8',
        'prefix' => '',
    ],

Any feedback would be appreciated :)

EDIT:

I tried "php arsian serve" as suggested and got an error message:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/sqlsrv' - /usr/lib/php/20160303/sqlsrv: cannot open shared object file: No such file or directory in Unknown on line 0

.env content:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=inventoryapp
DB_USERNAME=root
DB_PASSWORD=****

DB_CONNECTION2=sqlsrv
DB_HOST2=****
DB_PORT2=1433
DB_DATABASE2=i4
DB_USERNAME2=****
DB_PASSWORD2=****

1 Answer 1

1

There is file called .env in the root folder, set the DB_HOST2 and DB_PORT2 value there.

after that re-run the php artisan serve

Sign up to request clarification or add additional context in comments.

3 Comments

I'v set values. But php artisan serve gave me an error that I'll add to question
check the value and be sure you put it the right value
also, paste the .env content

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.