Forum Discussion

KatiS2285's avatar
KatiS2285
Copper Contributor
Jul 08, 2023

SQL server connection

Hi

 

I need to access sql server from a vm using 'Microsoft OLE DB provider for SQL server’.

 

I tested my connection, it works with ‘SQL Server Native Client 11.0’  but not MS OLE DB.

 

How could I fix it? Should I install any dll? if yes, where can I find it?

 

Sorry, I am just learning this stuff.

 

Thank you very much for your help

K

    • KatiS2285's avatar
      KatiS2285
      Copper Contributor

      olafhelper 

      Good morning

       

      Here is the error  

      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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
      08:49:02 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)
      08:49:02 at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
      08:49:02 at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
      08:49:02 at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
      08:49:02 at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
      08:49:02 at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
      08:49:02 at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
      08:49:02 at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
      08:49:02 at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
      08:49:02 at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
      08:49:02 at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
      08:49:02 at System.Data.SqlClient.SqlConnection.Open()

       

      when in Web.config, the provider name is {providerName="System.Data.SqlClient"} 

       

      Thank you

      • yunusemre's avatar
        yunusemre
        Copper Contributor

        You should check "SQL Server configuration manager--> protocols for mssqlserver --> tcp/ip" it must be enabled. After enabling restart the service

         

        And also you may check the status of Windows firewall on database server. It must be disabled or allowed for SQL server ports (1433)

         

         

         

         

         

        KatiS2285 

Resources