listing databases on Azure  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

listing databases on Azure  Topic is solved

Postby perry » Thu May 06, 2021 2:02 pm

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 7758 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
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: listing databases on Azure

Postby Mike.Sheen » Thu May 06, 2021 2:07 pm

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.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: listing databases on Azure

Postby perry » Thu May 06, 2021 2:56 pm

Hi Mike,

Thanks it worked!
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests