Page 1 of 1

listing databases on Azure  Topic is solved

PostPosted: Thu May 06, 2021 2:02 pm
by perry
Hi All,

I'm having trouble getting list of databases from an Azure DB (just this one).
The connection details (server/username/password) are 100% correct.

When I click the dropdown for list of databases, it waits for like 10s and nothing comes up.
Capture.PNG
Capture.PNG (4.7 KiB) Viewed 7764 times


I wonder how I can debug this issue?

I tried a console app and was able to get list of database names

Code: Select all
Dim server1 As New Microsoft.SqlServer.Management.Smo.Server(New ServerConnection("oneThatWorks.database.windows.net", "adminuser", "password"))
        Dim server As New Microsoft.SqlServer.Management.Smo.Server(New ServerConnection("oneThatDoesntWork.database.windows.net", "adminuser", "password"))
        Dim dblist As New List(Of String)

        For Each db As Microsoft.SqlServer.Management.Smo.Database In server.Databases
            dblist.Add(db.Name)
        Next


The only different I can see is if I do below from Immediate Window in VS, it gives me below.
Code: Select all
? server.databases.Count
testApp.exe Information: 0 : 2021-05-06T13:00:23.0613533+10:00 - get data for urn: Server[@Name='xxxx']/Database
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.SqlServer.Management.Common.ConnectionFailureException' in Microsoft.SqlServer.ConnectionInfo.dll
3

Re: listing databases on Azure

PostPosted: Thu May 06, 2021 2:07 pm
by Mike.Sheen
perry wrote:Hi All,

I'm having trouble getting list of databases from an Azure DB (just this one).
The connection details (server/username/password) are 100% correct.

When I click the dropdown for list of databases, it waits for like 10s and nothing comes up.
Capture.PNG


I wonder how I can debug this issue?

I tried a console app and was able to get list of database names

Code: Select all
Dim server1 As New Microsoft.SqlServer.Management.Smo.Server(New ServerConnection("oneThatWorks.database.windows.net", "adminuser", "password"))
        Dim server As New Microsoft.SqlServer.Management.Smo.Server(New ServerConnection("oneThatDoesntWork.database.windows.net", "adminuser", "password"))
        Dim dblist As New List(Of String)

        For Each db As Microsoft.SqlServer.Management.Smo.Database In server.Databases
            dblist.Add(db.Name)
        Next


The only different I can see is if I do below from Immediate Window in VS, it gives me below.
Code: Select all
? server.databases.Count
testApp.exe Information: 0 : 2021-05-06T13:00:23.0613533+10:00 - get data for urn: Server[@Name='xxxx']/Database
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.Data.SqlClient.SqlException' in Microsoft.Data.SqlClient.dll
Exception thrown: 'Microsoft.SqlServer.Management.Common.ConnectionFailureException' in Microsoft.SqlServer.ConnectionInfo.dll
3


We enumerate the Azure databases using the credentials JiwaLogin / JiwaApplicationLogin123.

So, that login needs to exist - try your console app with those credentials instead - you'll probably see you don't see the databases either. Create the login JiwaLogin with the password JiwaApplicationLogin123.

Re: listing databases on Azure

PostPosted: Thu May 06, 2021 2:56 pm
by perry
Hi Mike,

Thanks it worked!