MS SQL ODBC 17 Driver connects first tme but then give SSL Provider error:140A90F1:lib(20):func(169):reason(241) - unixodbc

I am facing this issue with dotNET core app, that connects and disconnects with SQL server using DSN defined in odbc.ini. Currently I am using the latest MS SQL ODBC driver i.e. msodbcsql17-17.4.2.1-1 and UnixODBC driver unixODBC 2.3.7.
I have tried downgrading the MSSQL ODBC driver to 11 and 13 as well but none worked.
My current DSN settings from odbc.ini is as under:
[ICMDB]
Driver = /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.4.so.2.1
Server = 10.32.7.145
Port = 1433
User = user
Password = password
Database = inst3_sideA
Language = us_english
and Logs file contain following errors:
2020-01-05 05:07:50.541 [T:9 P:17003] [FATAL] dbconnectivity.dbconnectivity ODBC Connected with Failure with connection string DSN=ICMDB;UID=qauser;Pwd=Password1;
System.Data.Odbc.OdbcException (0x80131937): ERROR [08001] [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:140A90F1:lib(20):func(169):reason(241)]
ERROR [08001] [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
Thanks in advance!

Luckly, I have observed the same issue on the same day and same IP as well. Your currently installed mysql odbc driver is 8.0.19 which do not have backward compatibility. Downgrade your mysql odbc driver to 8.0.17 and then see it will be error free. :)

Related

Why am I not able to use User SQL Server Authentication using SQL Server Import and Export Wizard?

Data Source Screen shot
I am trying to export a table from one database to another using SQL Server Import and Export Wizard (MS SQL Server Management Studio 17).
For reasons, I am not able to use SQL Server Authentication, it would prompt error as seen in the screen shot.
It would work if I changed authentication to use Windows Authentication. However, I need to use SQL Server Authentication to be able to select the desired table to export. Those tables would be invisible using Windows Authentication. I logged into the database using SQL Server Authentication.
Can someone tell me what I did wrong? Thanks!
Error Detail:
Invalid authorization specification
Invalid connection string attribute (Microsoft SQL Server Native Client 11.0)
------------------------------
Program Location:
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.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.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at Microsoft.SqlServer.Dts.DtsWizard.DTSWizard.GetOpenedConnection(WizardInputs wizardInputs, String connEntryName)
at Microsoft.SqlServer.Dts.DtsWizard.Step1.OnLeavePage(LeavePageEventArgs e)
Blockquote

Unable to connect SQL Server from some computer

I am using Microsoft SQL Server 2019 (OS: Windows Server 2019). It is running fine till yesterday. But suddenly I am not able to connect the database. I did not change anything, but still I check service status, ping that ip, port number, firewall, as well as firewall of local computer. Everything is ok, but unable to connect database (but also connect to server using remote desktop, no firewall issue). Interestingly some other computer can connect database normally (using SQL Server Management Studio 2018).
From yesterday, I try to find out the issue, but not getting any hints. If there is problem on server then no one will connect. If firewall block me (from both side), then I can not connect server.
Can any one please give some idea? Please...
Update:
I try to check port using: Test-NetConnection xxx.xxx.xxx.xxx -Port 1433 (using PowerShell). But result is fail (But it successfully connect IP).
Attaching Error (SQL Server Management Studio 2018)
Cannot connect to xxx.xxx.xxx.xxx.
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) (.Net SqlClient Data Provider)
For help, click: https://learn.microsoft.com/sql/relational-databases/errors-events/mssqlserver-53-database-engine-error
Error Number: 53
Severity: 20
State: 0
Program Location:
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
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.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
===================================
The network path was not found

Cannot create new user in SQL Server

Everythiing was working fine
My laptop has SQL Server installed
I formatted my laptop
Installed SQL Server (latest version)
then Changed my computer name
Old name was : DESKTOP-EP40R17
New Name is : DELLG3
Now trying to add new user to access databases as i used to do before formatting
I added new user called demo
And setup the user as I did before
but when I try to add new computer name to Securables
I get this error
How to fix that and get a new user working?
I tried deleting the user and create a new user still getting no luck accessing the server with new user id
Edit
I removed the old server name from SQL Server and added new server name using this script
SELECT ##SERVERNAME
sp_dropserver 'DESKTOP-EP40R17'
sp_addserver 'DELLG3', 'local'
Problem still occurs
I cannot login using the new user ID
Here how it looks like now
Here is the error text
===================================
Cannot connect to DELLG3.
===================================
Login failed for user 'demo'. (.Net SqlClient Data Provider)
------------------------------
For help, click: https://learn.microsoft.com/sql/relational-databases/errors-events/mssqlserver-18456-database-engine-error
------------------------------
Server Name: DELLG3
Error Number: 18456
Severity: 14
State: 1
Line Number: 65536
------------------------------
Program Location:
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
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.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
You will need to restart MSSQL(SQL Server) with SQL Server Configuration Manager(SSCM) to log in with SQL Server Authentication as shown below. This is How to find SQL Server Configuration Manager in your Windows Machine:
Because, you would change "Server authentication" from "Windows Authentication mode" to "SQL Server and Windows Authentication mode", then click on "OK":
Then, you would get this message below:
Some of your configuration changes will not take effect until SQL Server is restarted.
So, as the message says, "Server authentication" is still "Windows Authentication mode" until restarting MSSQL with SSCM. That's why you couldn't log in with SQL Server Authentication, then got the error.
Actually, I got the same error below when I changed "Server authentication" from "Windows Authentication mode" to "SQL Server and Windows Authentication mode", then tried to log in with SQL Server Authentication without restarting MSSQL with SSCM. So, I restarted MSSQL with SSCM, then I could log in with SQL Server Authentication without getting the error:

Could not retrieve table list. - SQL Server Import and Export - SQL Server Native Client RDA 11.0

I am trying to import data to database from text file. I have SQL Server 2019 installed. I am using SQL Server Native Client RDA 11.0. For some reason I cannot connect to the database when I want to set the data destination. This is the message I get:
Could not retrieve table list. (SQL Server Import and Export Wizard)
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.
Client unable to establish connection
Registry information is corrupt or missing. Make sure the provider is installed and registered correctly. (Microsoft SQL Server Native Client 11.0)
Program Location:
w System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
w System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
w System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
w System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) w System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
w System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
w System.Data.OleDb.OleDbConnection.Open()
w Microsoft.SqlServer.Dts.DtsWizard.SQLServerForm.LoadDatabasesList()
I've tried looking for some solutions on the internet, but I haven't found anything concrete and I have no idea what to do about it next.
I have found a solution. After installing SQL Server 2012 Native Client, I was able to connect to the server.

Unable to connect to AWS database from SSMS

I have created a Microsoft SQL server database with Amazon RDS. I have created a security group with an inbound rule which includes my IP. I modified the DB instance to include that security group. I Copy and pasted the connection endpoint and pasted that into the server name field of Microsoft SQL Server connect window followed by a comma and port number 1433. I use SQL server authentication with the correct credentials. This is the Error I get when I try to connect, What am I missing?
Cannot connect to "copied name of endpoint...."us-east-1.rds.amazonaws.com,1433.
===================================
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: 0 - The wait operation timed out.) (.Net SqlClient Data Provider)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=258&LinkId=20476
Error Number: 258
Severity: 20
State: 0
Program Location:
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, 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.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
===================================
The wait operation timed out
Solved,
I modified the DB instance via AWS portal to enable public access, then I added "TrustServerCertificate=True" to the connection string via SSMS connection options. I am able to connect now.

Resources