开发者

Enumerate Database on SQL Server 2008 Cluster

开发者 https://www.devze.com 2023-02-17 17:25 出处:网络
Our IT department recently moved from our databases to a cluster. This move broke many legacy applications that enumerate the databases with the following code:

Our IT department recently moved from our databases to a cluster. This move broke many legacy applications that enumerate the databases with the following code:

Dim objConn As ServerConnection
objConn = New ServerConnection()

If Me.ComboServers.Text.Trim.Length() > 0 Then
    objConn.ServerInstance = Me.ComboServers.Text.Trim()
End If


Me.SMOServer = New Server(objConn)
Me.ComboDatabases.Items.Clear()
For Each objDB As Database In Me.SMOServer.Databases
    Me.ComboDatabases.Items.Add(objDB.Name)
Next

This code works well enough when connecting to a standalone database but开发者_JS百科 will not connect to a named instance on a SQL cluster.

How can I enumerate the databases on a named instance on a SQL cluster?


Discovery of named instances relies on SQL Server Browser Service. There is a known issue with the SQL Browser service and Windows Firewall that occurs on clusters. See Unable to connect to a SQL Server named instance on a cluster. There are specific updates to OS and SQL itself required to be applied, see the linked article for details. A good workaround is to use static ports and explicitly specify the listening port in the connection string(s).

0

精彩评论

暂无评论...
验证码 换一张
取 消