Cannot connect to SQL Server in update-database - .net-core

I'm getting this error when running Update-Database command from package manager console:
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: SNI_PN11, error: 25 - Connection string is not valid).
The connection string I have used is:
"ConnectionStrings": {
"CarConnectionString": "server=servername\\SQLEXPRESS, database=CarModel, Trusted_connection=true"
}
Any help, suggestions will be highly appreciated

Thanks for the suggestions in the comments.
The correct connection string is:
"ConnectionStrings": {
"CarConnectionString": "server=server\\SQLEXPRESS, 1433; database= CarModel; Trusted_connection=true"
}

Related

A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - Success)

Unhandled exception. System.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - Success)
This is a NET5.0 console app using dapper to execute a stored procedure that will not store a result. The app is running from a linux docker container (Docker Desktop - Windows). The error happens each time a new container is created, and run for this first time. If the container is run again, the error will not occur.
using(IDbConnection sc = new SqlConnection("Server=my-azure-managed-instance.database.windows.net;Database=MyDB;User Id=me;Password=pw;")
{
sc.Execute("usp_MyProcedure", commandType: CommandType.StoredProcedure);
}
Does anyone know what situations might end up with "(provider: TCP Provider, error: 0 - Success)" as an error message?

SQL Server database connection fails

My asp.net website cannot connect to my SQL Server database, it shows this error message:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
My connection string is:
Data Source=localhost;Initial Catalog=admin_;Integrated Security=False;User ID=*****;Password=****;Connect Timeout=15;Encrypt=False;Packet Size=4096

WAS 8.5.9 Datasource failed......DSRA0010E: SQL State = 42601, Error Code = -104 getting error code in Application

I am using WAS 8.5.9 version, looks like some datasource connection problem but when I click on test connection button in WAS console it is showing connection is fine.But When I am running my application it is throwing error and in Error logs it is showing below error
[financing_tools_docgen] [DBConnection] [04/27 14:18:45.759] [ERROR] [Severity 2] [[abcdefd#gmail.com][145681]] getConnection() : Got SQLException :com.ibm.websphere.ce.cm.StaleConnectionException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=SNAPSHOT;MODE, DRIVER=3.57.82 DSRA0010E: SQL State = 42601, Error Code = -104
In Application logs getting below error
[financing_tools_docgen] [DBConnection] [04/27 14:18:43.723] [DEBUG] [Severity 4] [[abcded#gmail.com][145681]] Trying to get connection object with ICFS DS=ICFS_IR1T , JNDI value=jdbc/financing_tools_docgen_txtmgr
[financing_tools_docgen] [DBConnection] [04/27 14:18:45.759] [ERROR] [Severity 2] [[abcded#gmail.com][145681]] getConnection() : Got SQLException :com.ibm.websphere.ce.cm.StaleConnectionException: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=SNAPSHOT;MODE, DRIVER=3.57.82 DSRA0010E: SQL State = 42601, Error Code = -104
Here is the DB2 documentation for SQLState 42601 with Error Code -104,
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.messages.sql.doc/doc/msql00104n.html
It sounds like a syntax error rather than a stale connection. I think the application server has misclassified it here. That would be consistent with test connection operation still working, because connection can be obtained successfully, but the error is occurring when executing a SQL command with a syntax error. You should look into the SQL that is being used and see if you can correct.

R - connecting to SQL Server using using RSQLServer

I want to use RSQLServer instead of RODBC to connect to a database called 'Mkt_DW'. I think my server hostname is my machine DHX number - that's what is returned when I query the hostname in SQL Server 2008 using:
SELECT HOST_NAME() AS HostName, SUSER_NAME() LoggedInUser
I then enter the following code into R Studio:
library(RSQLServer)
library(DBI)
driver <- dbDriver("SQLServer")
url <- "DHX32510;Database=Mkt_DW;Trusted_Connection=TRUE;"
conn <- dbConnect(driver, url)
I get the following error:
Error in rJava::.jcall(drv#jdrv, "Ljava/sql/Connection;", "connect", url, :
java.sql.SQLException: Network error IOException: Connection refused: connect
Can anyone tell me what I'm doing wrong?
Thanks,
Neil
It is because it cannot find the 'sql.yaml' file:
See not from the package author:
"See ?SQLServer. It will look for the YAML file in the following location by default: Sys.getenv("HOME")"
https://github.com/imanuelcostigan/RSQLServer/issues/57

Biztalk got an error "A transport-level error has occurred when receiving results from the server"

Our Biztalk (2006R2) faced an error as below:
Error 1
Event Type: Error
Event Source: ENTSSO
Event Category: Enterprise Single Sign-On
Event ID: 10514
Date: 2/14/2014
Time: 5:02:27 PM
User: N/A
Computer: NINI-SSPP03
Description:
An error occurred while attempting to access the SSO database.
Function: GetGlobalInfo
File: infocache.cpp:1349
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.).
SQL Error code: 0x00000040
Error code: 0xC0002A21, An error occurred while attempting to access the SSO database.
Error2
The following stored procedure call failed: " { call admsvr_ReceiveLocation_GetAllInApp( ?)}". SQL Server returned error string: "[DBNETLIB][ConnectionRead (recv()).]General network error. Check your network documentation.".
But we cannot find any error in SQL Server event log and SQL Server log.
Is there any idea on the possible cause of this error?
Thanks.

Resources