Provider sql network interfaces error 25 connection string is not valid

Hi, I just installed SQL Server 2008 full edition on my machine but am not able to connect to the default MSSQLSERVER database.  When I set it up, I specified Windows authentication.  And so that is how I try to connect to it.  And even though I see the MSSQLSERVER service in the Sql Server Configuration Manager, I still can't connect to it.  I tried modifying the protocols and even enabling FILESTREAM, but none of this helped.  How can I fix this?=================================== Cannot connect to D610-MMSSQLSERVER. =================================== 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: 25 - Connection string is not valid) (.Net SqlClient Data Provider) ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=87&LinkId=20476 ------------------------------ Error Number: 87 Severity: 20 State: 0 ------------------------------ Program Location: at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server) at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()

Hi, I just installed SQL Server 2008 full edition on my machine but am not able to connect to the default MSSQLSERVER database.  When I set it up, I specified Windows authentication.  And so that is how I try to connect to it.  And even though I see the MSSQLSERVER service in the Sql Server Configuration Manager, I still can’t connect to it.  I tried modifying the protocols and even enabling FILESTREAM, but none of this helped.  How can I fix this?

===================================

Cannot connect to D610-MMSSQLSERVER.

===================================

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: 25 — Connection string is not valid) (.Net SqlClient Data Provider)

——————————

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=87&LinkId=20476

——————————

Error Number: 87

Severity: 20

State: 0

——————————

Program Location:

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)

at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)

at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)

at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)

at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()

Содержание

  1. Provider sql network interfaces error 25 недопустимая строка подключения
  2. Answered by:
  3. Question
  4. sql network interfaces error 25 — connection string is not valid
  5. Provider sql network interfaces error 25 недопустимая строка подключения
  6. Answered by:
  7. Question
  8. SQL Network Interfaces, error: 25 — Connection string is not
  9. Comments
  10. Provider sql network interfaces error 25 недопустимая строка подключения

Provider sql network interfaces error 25 недопустимая строка подключения

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Hi, I just installed SQL Server 2008 full edition on my machine but am not able to connect to the default MSSQLSERVER database. When I set it up, I specified Windows authentication. And so that is how I try to connect to it. And even though I see the MSSQLSERVER service in the Sql Server Configuration Manager, I still can’t connect to it. I tried modifying the protocols and even enabling FILESTREAM, but none of this helped. How can I fix this?

Cannot connect to D610-MMSSQLSERVER.

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: 25 — Connection string is not valid) (.Net SqlClient Data Provider)

Источник

sql network interfaces error 25 — connection string is not valid

September 9, 2016 at 3:43 am

How can I fix this following error? What might be the possible reasons that is blocking me to connect with SQL?

This morning when I tested in UDL with port, it is working fine. SERVER NAMEMSSQLSERVER,1433

Connection string I use in my C# program is «Server=SERVERNAME\MSSQLSERVER;» +»Integrated Security=SSPI;»+»database=UserAccounts» . I am using SQL 2012 with visual studio 2012.

An error occurred while attempting to add the account. 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: 25 — Connection string is not valid)

One Orange Chip

September 11, 2016 at 10:23 pm

Your problem is probably related to you attempting to connect to an instance called «MSSQLSERVER». Yes this instance name does look like the name of the default instance (e.g. when you look in Services) but when you specify an instance name, SQL tries to find someone with that name which really doesn’t exist.

In your connection string that worked, you specify the port number (which happens to be the port number of the default instance) along with an instance name (MSSQLSERVER). The instance name is NOT used when connecting because you specified the port number.

Источник

Provider sql network interfaces error 25 недопустимая строка подключения

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

Hi, I just installed SQL Server 2008 full edition on my machine but am not able to connect to the default MSSQLSERVER database. When I set it up, I specified Windows authentication. And so that is how I try to connect to it. And even though I see the MSSQLSERVER service in the Sql Server Configuration Manager, I still can’t connect to it. I tried modifying the protocols and even enabling FILESTREAM, but none of this helped. How can I fix this?

Cannot connect to D610-MMSSQLSERVER.

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: 25 — Connection string is not valid) (.Net SqlClient Data Provider)

Источник

SQL Network Interfaces, error: 25 — Connection string is not

I had Nav 2009 installed on my machine.
Have uninstalled everything and reinstalled Nav 09.

I am getting following error when i am trying to open it:


‘The Microsoft Dynamics Server cannot connect the Change Listener to SQL server due to the following 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 instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 — Connection string is not valid).

well, when you open NAV 2009 — Classic Client, I suppose — and log on to the SQL Server you are doing this with your «Windows Login». This Login has to be defined/setup in SQL Server properly or must belog to the «Administrator» group.
If you have already configured Logins in NAV you must assure those are setup on SQL Server site.

(Same goes for the Service Tier, the service must run with an account which is setup on SQL site to log on)

One more thing i forgot to mention, make sure that the «Log On As» for Microsoft Dynamics Nav Server in services is local system account (admin preferred). If it is any other account then again make sure you have admin rights under sql for that account.

i have the same problem. But my user is in the administrator group. What do i really have to do? And do you mea windows users and groups or database users and groups? I have windows authentification too.

And by the way. Is it really right to solve such a problem to add anything to the administrator group? Aren’t there better ways??

Well, i still get this error 25 — Connection string is not valid.

What i have.
— Checked that my server accepts remote connections
— Added new Login for my user
— Set serverrole to public, like stryk wrote
— Opend classic client and added my windows user (The Windows user of my local system is Barechen/Nic, but on the server its ATM/Nic. Could that be the problem?
— After that i synchronized the user.

But when i open the role tailored client i get still this error. It seems that he can not connect to the server. i checked the TCP-Settings and activated and enabled the TCP-Connection. Do i have to make an entry in the firewall for the TCP-Port? The TCP-Port seems to be 1433. Thats another one than the Dynamics Service wanted (7046)..

I also tried to start the RTC in administrator mode, but that wasn’t the problem. 🙁

“This posting is provided «AS IS» with no warranties, and confers no rights.”

Источник

Provider sql network interfaces error 25 недопустимая строка подключения

Доброе утро всем.

Помогите решить проблему.
Вроде все делаю по инструкции:
С подобной строкой спокойно конекчусь к бд из sqldeveloperа, из делфи (через odac). Все довольны, никто не ругается
BLToolkit почему-то не хочет.

Но этот код выдает такое сообщение.
BLToolkit.Data.DataException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и что на SQL Server разрешены удаленные соединения. (provider: SQL Network Interfaces, error: 25 — Недопустимая строка подключения) —> System.Data.SqlClient.SqlException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и что на SQL Server разрешены удаленные соединения. (provider: SQL Network Interfaces, error: 25 — Недопустимая строка подключения)

От: Jack128
Дата: 28.11.12 07:04
Оценка:

Здравствуйте, MAMOHT, Вы писали:

Ты б фигней не страдал, а ConnectionStringBuilder’ы использовал. BLToolkit тут кстати не причем. Можешь напрямую OraDbConnection или как он там оракла называется, создават- наверника таже ошибка будет.

MAM>BLToolkit.Data.DataException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и что на SQL Server разрешены удаленные соединения. (provider: SQL Network Interfaces, error: 25 — Недопустимая строка подключения) —> System.Data.SqlClient.SqlException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и что на SQL Server разрешены удаленные соединения. (provider: SQL Network Interfaces, error: 25 — Недопустимая строка подключения)

От: MAMOHT
Дата: 28.11.12 07:28
Оценка:

Здравствуйте, Jack128, Вы писали:

J>Ты б фигней не страдал, а ConnectionStringBuilder’ы использовал. BLToolkit тут кстати не причем. Можешь напрямую OraDbConnection или как он там оракла называется, создават- наверника таже ошибка будет.

Чтобы не страдать фигней, надо знать как это делать. Спасибо, что просвятил насчет билдеров.
Жаль, что не помогло.

А еще я написал в первом сообщении следующее:
M> С подобной строкой спокойно конекчусь к бд из sqldeveloperа, из делфи (через odac). Все довольны, никто не ругается.
Почему я не должен доверять этой строке?

P.S. Возможно, дело и не в BLToolkit. Я C# только недавно начал изучать и БД на них еще не трогал.
Возможно, нужна какая-то сборка или длл дополнительная. Я пока что полный ноль в связке C# и oracle;

От: MAMOHT
Дата: 28.11.12 08:27
Оценка:

Теперь точно дело в BLToolkit.
Подключил System.Data.OracleClient;

Вот такой код работает:

Следующий код выдают ошибку:

Текст ошибки:
BLToolkit.Data.DataException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и что на SQL Server разрешены удаленные соединения. (provider: Named Pipes Provider, error: 40 — Не удалось открыть подключение к SQL Server) —> System.Data.SqlClient.SqlException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и что на SQL Server разрешены удаленные соединения. (provider: Named Pipes Provider, error: 40 — Не удалось открыть подключение к SQL Server)
в System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
в System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

От: MAMOHT
Дата: 28.11.12 09:03
Оценка:

Вот такой вариант заработал:

Вопрос: почему у меня не проходит вот такой вариант:

От: wildwind
Дата: 28.11.12 19:24
Оценка:

Здравствуйте, MAMOHT, Вы писали:

MAM>Текст ошибки:
MAM>BLToolkit.Data.DataException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным

Очевидно BLToolkit подсовывает MSSQL провайдера вместо ораклового. Рой конфиги.

От: seregaa http://blogtani.ru
Дата: 29.11.12 11:05
Оценка:

Здравствуйте, MAMOHT, Вы писали:

MAM>Вот такой вариант заработал:

MAM>

Попробуй так DbManager.AddConnectionString(«ODP», «Oracle», conString);
Эта версия метода явно указывает, какой провайдер использовать для подключения.

От: Plague 177230800
Дата: 29.11.12 12:42
Оценка:

MAM> string conString=»Data Source=oks/oks@db09-gyr:1521:OKS»;

Не знаю как на счет остального кода, но, возможно, не правильная строка подключения.
Данная строка подключения называется Easy Connect Naming Method.
Поподробнее можно глянуть в документе Oracle
или на OraFAQ.com

строка должна выглядеть так:

соответственно в коде

От: MAMOHT
Дата: 30.11.12 07:23
Оценка:

Здравствуйте, seregaa, Вы писали:

S>Попробуй так DbManager.AddConnectionString(«ODP», «Oracle», conString);
S>Эта версия метода явно указывает, какой провайдер использовать для подключения.

Да, помогло. Теперь можно писать как в примерах: var db = new DbManager()
Спасибо.

Пойду теперь осваивать accessoры.

От: Jack128
Дата: 30.11.12 08:33
Оценка:

Здравствуйте, MAMOHT, Вы писали:

MAM>Здравствуйте, Jack128, Вы писали:

J>>Ты б фигней не страдал, а ConnectionStringBuilder’ы использовал. BLToolkit тут кстати не причем. Можешь напрямую OraDbConnection или как он там оракла называется, создават- наверника таже ошибка будет.

MAM>Чтобы не страдать фигней, надо знать как это делать. Спасибо, что просвятил насчет билдеров.
MAM>Жаль, что не помогло.

MAM>

Естественно не помогло.

SqlConnectionStringBuilder Class
.NET Framework 4.5 Other Versions This topic has not yet been rated — Rate this topic
Provides a simple way to create and manage the contents of connection strings used by the SqlConnection class.

SqlConnection Class
.NET Framework 4.5 Other Versions 3 out of 3 rated this helpful — Rate this topic
Represents an open connection to a SQL Server database

Источник

Symptoms

Assume that you install SQL Server 2019 Developer Edition with the standard networking configuration in which TCP/IP protocol is not enabled by default. In this situation, you notice that the PolyBase services are unable to start successfully. Additionally, PolyBase services may create full memory dumps, and you may receive an error message that resembles the following:


DateTime [Thread:3876] [DiagnosticsConnectionWrapper:ErrorEvent] (Error, High): Error while opening connection (Data Source=SBK-VNEXT-WIN1,0;Initial Catalog=master;Integrated Security=True;Pooling=True;Min Pool Size=1;Max Pool Size=100;MultipleActiveResultSets=True;Application Name=DWDiagnostics).

System.Data.SqlClient.SqlException[87:0]: 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: 25 — Connection string is not valid) —> System.ComponentModel.Win32Exception: The parameter is incorrect

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

Resolution

This issue is fixed in the following cumulative update for SQL Server:

  • Cumulative Update 2 for SQL Server 2019

About cumulative updates for SQL Server:

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

  • Latest cumulative update for SQL Server 2019

Workaround

To work around this issue, TCP/IP protocol must be enabled by default during installation of SQL Server 2019 Developer Edition (or enabled post installation). 

References

Learn about the terminology that Microsoft uses to describe software updates.

Need more help?

Here is my error:

The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=51; handshake=391; [Login] initialization=0; authentication=5; [Post-Login] complete=14017; ---> System.ComponentModel.Win32Exception (0x80004005): Unknown error 258n at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)n at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)n at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)n at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)n at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)n at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)n at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)n at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)n at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry)n at System.Data.SqlClient.SqlConnection.Open()n at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)n at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.BufferlessMoveNext(Boolean buffer)n at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded)n at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.GetResult[TResult](IEnumerable1 valueBuffers, Boolean throwOnNullResult)n at lambda_method(Closure , QueryContext )n at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_11.<CompileQueryCore>b__0(QueryContext qc)n

Приветствую всех посетителей сайта Info-Comp.ru! Сегодня мы рассмотрим ситуацию, когда Вы пытаетесь подключиться к Microsoft SQL Server по сети, но Вам это не удаётся, так как возникает та или иная ошибка подключения.

В этом материале представлен последовательный план действий, который поможет Вам выявить и устранить причину возникновения таких ошибок подключения, и тем самым успешно подключиться к Microsoft SQL Server.

Не удается подключиться к Microsoft SQL Server по сети. Устраняем ошибку подключения

Итак, давайте начнем. Допустим, у нас есть Microsoft SQL Server, установленный на Windows, и мы будем пытаться подключится к нему по сети, например, из операционной системы Linux, используя Azure Data Studio.

Заметка! Как подключиться к Microsoft SQL Server из Linux.

В процессе подключения у нас возникает ошибка, и, чтобы ее устранить, мы будем последовательно выполнять определенные проверочные действия, которые помогут нам выявить причину этой ошибки.

Содержание

  1. Корректность ввода данных для подключения
  2. Доступность сервера по сети
  3. Открытые порты в брандмауэре
  4. Запущена ли служба «Обозреватель SQL Server»
  5. Запущена ли служба «SQL Server»
  6. Включен ли протокол «TCP/IP»
  7. Удаленные соединения с серверов
  8. Права имени входа, сопоставление с пользователем базы данных
  9. Подведение итогов

Корректность ввода данных для подключения

Первое, с чего необходимо начать, это, конечно же, с проверки данных для подключения, т.е. правильно ли мы указываем адрес сервера и имя экземпляра (если используется именованный экземпляр).

Дело в том, что если мы неправильно укажем адрес сервера, или не укажем имя экземпляра SQL Server, или ошибемся хотя бы в одной букве, подключиться мы не сможем.

Имя экземпляра SQL Server необходимо указывать в тех случаях, когда у нас настроен именованный экземпляр, например, в редакции Express по умолчанию настраивается именованный экземпляр и динамические порты.

Если не указать имя экземпляра, когда это имя необходимо указывать, мы получим ошибку

«provider: TCP Provider, error: 40 – could not open a connection to SQL Server»

А если допустить ошибку в имени экземпляра, то

«provider: TCP Provider, error: 25 – connection string is not valid»

Поэтому лучше сразу проверить корректность ввода данных для подключения.

Скриншот 1

Заметка! Обзор инструментов для работы с Microsoft SQL Server.

Доступность сервера по сети

Если данные для подключения верны, то следующим шагом будет, конечно же, проверка доступности сервера, так как если сервер физически недоступен, то все следующие проверки будут абсолютно бесполезны и ни к чему не приведут.

Если сервер недоступен, то Вы будете получать уже знакомую ошибку

«provider: TCP Provider, error: 25 – connection string is not valid»

Проверить доступность сервера можно стандартным способом, используя утилиту ping в командной строке.

Скриншот 2

Если сервер недоступен, то Вам необходимо настроить сеть, чтобы физический сервер, на котором располагается SQL Server, был доступен с компьютера, с которого Вы хотите подключиться.

Открытые порты в брандмауэре

Если сервер, на котором располагается SQL Server, физически доступен, то сразу же необходимо на нем проверить доступность портов в брандмауэре Windows, или в файрволе, который Вы используете.

Стандартный порт, на котором работает SQL Server, это 1433, соответственно, необходимо настроить правило для входящих подключений по порту 1433.

В случае если Вы используете именованный экземпляр SQL Server и динамические порты, то у Вас должно быть настроено правило для программы, в частности для исполняемого файла SQL Server – sqlservr.exe.

Для 2019 версии он расположен по следующему пути

Курс по SQL для начинающих

«C:Program FilesMicrosoft SQL ServerMSSQL15.MSSQLSERVERMSSQLBinnSqlservr.exe»

Кроме этого, в данном случае необходимо еще открыть UDP порт 1434 для службы «Обозреватель SQL Server».

Подробная официальная инструкция «Настройка брандмауэра Windows для доступа к SQL Server».

Продолжая тему именованных экземпляров и динамических портов, стоит отметить, что если используется именованный экземпляр и динамические порты, то дополнительно должна быть запущена служба «Обозреватель SQL Server». Если она не запущена, то подключиться Вы не сможете, будет возникать все та же ошибка

«provider: TCP Provider, error: 25 – connection string is not valid»

Поэтому запустите SQL Server Configuration Manager и проверьте соответствующую службу.

Скриншот 3

Запущена ли служба «SQL Server»

Если сервер физически доступен, необходимые порты открыты, то следующим шагом следует проверить, а запущена ли в принципе служба SQL Server.

Ведь бывает и такое, что мы пытаемся подключиться к SQL Server, а его просто нет, т.е. он даже не запущен.

Поэтому проверяем, запущена ли служба «SQL Server» в SQL Server Configuration Manager.

Скриншот 4

Заметка! Сравнение Azure Data Studio с SQL Server Management Studio (SSMS).

Включен ли протокол «TCP/IP»

Кроме всего вышеперечисленного необходимо проверить, включен ли протокол «TCP/IP» в сетевой конфигурации SQL Server, так как если SQL Server используется в сети, данный протокол обязательно должен быть включен.

Это можно проверить в SQL Server Configuration Manager в разделе «Сетевая конфигурация SQL Server».

Скриншот 5

Удаленные соединения с серверов

Также необходимо проверить, разрешены ли удаленные соединения с серверов. Это можно сделать в SQL Server Management Studio в свойствах сервера на вкладке «Соединения», параметр «Разрешить удаленные соединения с сервером» должен быть включен.

Скриншот 6

Заметка! Как включить нумерацию строк кода в SQL Server Management Studio.

Права имени входа, сопоставление с пользователем базы данных

Имя входа, которое Вы указываете при подключении к SQL Server, должно обладать определенными правами, в частности оно должно быть сопоставлено с пользователем базы данных, если это не так, то Вы будете получать ошибку подключения, например

«При входе пользователя TestLogin произошла ошибка».

Поэтому необходимо проверить, сопоставлено ли имя входа с пользователем базы данных и предоставлены ли необходимые права.

Это можно сделать в SQL Server Management Studio, перейдите в контейнер «Безопасность -> Имена для входа», выберите нужное имя входа и зайдите в свойства этого имени. Затем на вкладке «Сопоставление пользователей» отметьте базы данных, с которыми будет сопоставлено данное имя входа, и задайте необходимые права в виде указания ролей базы данных.

Скриншот 7

Подведение итогов

Таким образом, на основе всего вышеизложенного мы можем составить план действий, следуя которому мы обязательно определим и устраним причину возникновения ошибки подключения к Microsoft SQL Server по сети.

Что необходимо сделать для устранения ошибки подключения к Microsoft SQL Server по сети:

Проверить корректность ввода данных для подключения

Проверить доступность физического сервера по сети

Открыть порты в брандмауэре (файрволе)

Проверить, запущена ли служба «Обозреватель SQL Server»

Проверить, запущена ли служба «SQL Server»

Проверить, включен ли протокол «TCP/IP»

Проверить, разрешены ли удаленные соединения с серверов

Проверить права имени входа и сопоставить с пользователем базы данных

Заметка! Курсы по Transact-SQL для начинающих.

На сегодня это все, надеюсь, материал был Вам полезен, пока!

Понравилась статья? Поделить с друзьями:
  • Psql on error stop
  • Psql exit on error
  • Psql error relation couriers does not exist
  • Psql error fatal password authentication failed for user postgres
  • Psql error could not connect to server fatal role root does not exist