C
C#16mo ago
Mayank

❔ Error in connection to database [ sql workbench]

can anyone please help..
22 Replies
SinFluxx
SinFluxx16mo ago
You need to provide $details to have a chance of anyone helping
MODiX
MODiX16mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Mayank
MayankOP16mo ago
$details
MODiX
MODiX16mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Mayank
MayankOP16mo ago
$details I am not able to connect to sql server
MODiX
MODiX16mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Jimmacle
Jimmacle16mo ago
he means actually type out what your problem is with enough detail that someone can give you meaningful advice
Mayank
MayankOP16mo ago
its a small problem in connection string .. don't need explanation
Jimmacle
Jimmacle16mo ago
sounds like you don't need help then
SinFluxx
SinFluxx16mo ago
Yeah, not sure how you expect any one to assist...
Mayank
MayankOP16mo ago
i need help $detail I am not able to connect with workbench in mac. but i am able to connect workbench through terminal but not from visual studio..Anyone can help please?
Jimmacle
Jimmacle16mo ago
what database? what is your connection string? is your server local or hosted somewhere else? what is the actual error message? these are the kind of details you need to provide
Mayank
MayankOP16mo ago
I am not using any database. I applied migration and just want to update database but when i am updating the database i am getting the error
Mayank
MayankOP16mo ago
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry, SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.OpenDbConnection(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at 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: Could not open a connection to SQL Server)
Mayank
MayankOP16mo ago
In short the error is this Microsoft.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: Could not open a connection to SQL Server) But i am able to connect through terminal and azure data studio with same user id and password and server is local host with all privileges granted
Jimmacle
Jimmacle16mo ago
you aren't using a database? but you're trying to connect to one? did you check the things the error is telling you to check?
Mayank
MayankOP16mo ago
i am checking from 3 days took help from chatgpt google actually i am using database first approach in this i am doing migration first then when i am updating it in db its not working its saying not able to open conection can we connect in meet please? @Jimmacle can you help please
SinFluxx
SinFluxx16mo ago
you still haven't shown how you're trying to connect
Mayank
MayankOP16mo ago
can we connect through meet { "ConnectionStrings": { "BloggieDbConnectionString": "Server=localhost;Database=BloggieDb;User=temp;Password=hide" }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*" } see i am doing this and the error is above
Jimmacle
Jimmacle16mo ago
can you show the code where you call .AddDbContext?
Mayank
MayankOP16mo ago
builder.Services.AddDbContext<BloggyDbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("BloggieDbConnectionString"))); One thing is that also in MAC my server instance automatically getting on and off can you please help>
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server