Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote sqlsrv connection problem #2996

Closed
kanfur opened this issue Jun 11, 2021 · 3 comments
Closed

remote sqlsrv connection problem #2996

kanfur opened this issue Jun 11, 2021 · 3 comments

Comments

@kanfur
Copy link

kanfur commented Jun 11, 2021

in .env

PHP_FPM_INSTALL_MSSQL=true
WORKSPACE_INSTALL_MSSQL=true

I have entered these commands

docker-compose build Nginx 
docker-compose restart //nginx mysql adminer workspace

and then I entered in my workspace container

I have a command like this;

`

       try { DB::connection("sqlsrv")->getPdo();
        echo( "\nConnected successfully to: (sqlsrv) " . DB::connection("sqlsrv")->getDatabaseName());
   
    } catch (\Exception $e) {
        die("\nCould not connect to the database. Please check your configuration. error:" . $e->getMessage() );
    }`

It gives an error:
Could not connect to the database. Please check your configuration. error:could not find driver

my .env db credientials

SQLSRV_DB_HOST=********.database.windows.net
SQLSRV_DB_DATABASE=***dbname
SQLSRV_DB_USERNAME=***username
SQLSRV_DB_PASSWORD=***password

Context information:

Output of git rev-parse HEAD

833c57a6b68b912a146378c0e112c1d2bd234888

Output of docker version

Docker version 20.10.6, build 370c289

Output of docker-compose version

docker-compose version 1.29.1, build c34c88b2
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020

System info: Mac, Windows or Linux. Include which disto/version

MacOS 11.2.3
@kanfur
Copy link
Author

kanfur commented Jun 11, 2021

I run this command
apt-get install freetds-common freetds-bin unixodbc php7.3-sybase

error : Could not connect to the database. Please check your configuration. error:SQLSTATE[01002] Adaptive Server connection failed (********.database.windows.net:1433) (severity 9)

However, I have tried these code group:
`

    try{
         
        $hostname = "********.database.windows.net";
        $dbname = "********";
        $username = "********";
        $pwd = "********";
        $dbh = new PDO ("dblib:version=8.0;charset=UTF-8;host={$hostname};dbname={$dbname}", $username, $pwd);
    
    } catch (PDOException $e) {
        echo "Failed to get DB handle: " . $e->getMessage() . "\n";
        exit;
    }

`

Output is; passed

@bestlong bestlong added the PHP Extension: sqlsrv / dblib (MSSQL) Microsoft SQL Server Functions label Jun 12, 2021
@stale
Copy link

stale bot commented Sep 10, 2021

Hi 👋 this issue has been automatically marked as stale 📌 because it has not had recent activity 😴. It will be closed if no further activity occurs. Thank you for your contributions ❤️.

@stale stale bot added the Stale label Sep 10, 2021
@stale
Copy link

stale bot commented Oct 1, 2021

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants