Access/Query SQLServer within Docker on Mac using c#/visual studio

0

I am new to development and C# - working on a MAC with Visual Studio Community - I installed Docker and installed MSSQL Linux within Docker. I created a database, added tables using Azure Data Studio. I can query the database from Azure. I want to connect to the SQL Database in Docker using c#, pull data from different tables, and run queries against the database. When attempting to connect with SQLConnection using ip with port, path or container id The error message is always

Initially I used [this code]:

public Inventory() 
{ 
    connection = new SqlConnection();
    connection.ConnectionString = "Data Source=XXXXX; initial catalog = DBName;integrated security = True; User ID = sa; Password=Password"; 
} 

Data source has been container ID, Path and IP address, port.

"Unhandled exception. 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: TCP Provider, error: 40 - Could not open a connection to SQL Server)"

c#
sql-server
macos
docker
asked on Stack Overflow Mar 27, 2020 by Orchids • edited Mar 28, 2020 by Frank Alvaro

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0