twright-msft / mssql-node-docker-demo-app

Demonstration application using Microsoft SQL Server on Linux and Node in a Docker container.
MIT License
298 stars 231 forks source link

Did exactly what is done in this demo, but i am getting : Login failed for user 'sa'. Reason: Failed to open the explicitly specified database 'CIT'. #4

Closed gsainagendraprasad closed 7 years ago

gsainagendraprasad commented 7 years ago

Hi @twright-msft , I am trying to do exactly the same thing as shown in your demo, Mine is windows machine and i allocated 7GB memory for dockere with 2 cpu's. When i run docker image with this below command-

docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=Yukon900 -d testsqlserver

I am getting this below error:

2017-08-21 16:58:23.16 Logon Error: 18456, Severity: 14, State: 38. 2017-08-21 16:58:23.16 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database 'CIT'. [CLIENT: 172.17.0.2] SQLState = 37000, NativeError = 4060 Error = [unixODBC][Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Cannot open database "CIT" requested by the login. The login failed. SQLState = 28000, NativeError = 18456 Error = [unixODBC][Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'sa'. SQLState = 08001, NativeError = 10057 Error = [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x2749 SQLState = 08001, NativeError = 10057 Error = [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.

Any kind of help is appreciated!!

gsainagendraprasad commented 7 years ago

Never mind , it finally worked with couple of changes.

First: our import-data.sh was not compatible to windows OS, we have to rewrite file by changing the preference to UNIX file.

Second in our entrypoint.sh we have to run sqlserver as the last one. like shown below. /scripts/import-data.sh & /opt/mssql/bin/sqlservr

we had it like this before and it didn't work : /opt/mssql/bin/sqlservr & /scripts/import-data.sh , and it was stopping the container as soon as the import-data.sh is completed executing. In other words it treating this as main process.

twright-msft commented 7 years ago

Glad you got things working!