As I mentioned, I have not managed to connect the container to SQL Operations Studio.
I am using docker compose to mount the containers, this is created correctly, but when I enter the credentials in SQL Server Operations Studio, it does not connect.
docker-compose.yml
version: '3'
services:
mssqllinux:
image: microsoft/mssql-server-linux:2017-latest
env_file:
- ./docker.env
ports:
- "1433:1433"
docker.env
sa_password=RUc@ysd@f_P*yq4é
ACCEPT_EULA=Y
MSSQL_PID=Express
λ docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------
sqlserlinux_mssqllinux_1 /opt/mssql/bin/sqlservr Up 0.0.0.0:1433->1433/tcp
Connection:
The error:
Error trace:
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (53): No se ha encontrado la ruta de acceso de la red
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.<>c__DisplayClass22_0.<TryGetConnection>b__0(Task`1 _)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.ReliableSqlConnection.<>c__DisplayClass28_0.<<OpenAsync>b__0>d.MoveNext() in D:\a\1\s\src\Microsoft.SqlTools.ServiceLayer\Connection\ReliableConnection\ReliableSqlConnection.cs:line 298
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.TryOpenConnection(ConnectionInfo connectionInfo, ConnectParams connectionParams) in D:\a\1\s\src\Microsoft.SqlTools.ServiceLayer\Connection\ConnectionService.cs:line 542
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:53,State:0,Class:20
Several steps you can try.
First to remember, though you are inside of windows, but the database server is actually inside of Linux, and Linux is super case sensitive system. So, be sure your username is SA or sa.
Second thing is, in the server and port value, use a comma (,) instead of the colon (:), like below
Third, if the above steps didn't work for you, first make sure you can access the server using SQLCMD tool. You can follow this microsoft document for details. After you can successfully login to the database, you can reuse the server value and credentials in SQL Operations Studio Window.
Hope this helps.
User contributions licensed under CC BY-SA 3.0