2

I set up a SlashDB instance in Azure following the instructions here.

I set up an Azure DB which I can access just fine from SSMS using the server admin account. The DB server firewall seems to be properly connected to the SlashDB server vnet subnet's service endpoint.

When I let SlashDB compose the connection string based on host & DB names, I get this error:

Couldn't load model bromach_dev due to OperationalError. (pyodbc.OperationalError) ('08001', u'[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)') (Background on this error at: http://sqlalche.me/e/e3q8)

Connection Error (Default Connection String)

When I override the connection string with the ODBC connection string from the Azure Portal, I get this error instead:

Couldn't load model bromach_dev due to InterfaceError. (pyodbc.InterfaceError) ('IM002', u'[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)') (Background on this error at: http://sqlalche.me/e/rvf5)

Connection Error (Azure Connection String)

In this case, the connection string I am using is:

Driver={ODBC Driver 13 for SQL Server};Server=tcp:org-dev.database.windows.net,1433;Database=bromach_dev;Uid=serveradmin@org-dev;Pwd=****************;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;

Ideas?

  • Is your SQL Server listening on TCP/IP port 1433 and allows for username/password based authentication? Please post how you made an instance of your Azure SQL, and we will try to replicate your issue. – Victor Olex Dec 26 '18 at 15:32
  • There is an issue with the new SlashDB image, which is related to this bug report https://github.com/Azure/WALinuxAgent/issues/1151. I will post a workaround in the answer. – Victor Olex Dec 26 '18 at 17:26

2 Answers2

1

In order for SlashDB to connect there must be an open TCP/IP route from its virtual machine instance to the Azure SQL Server (sorry if I am stating the obvious).

Also, there must be a working DNS resolver on SlashDB instance so it can obtain the IP address for your database host as configured in the connection string.

DNS Fix -- NO LONGER REQUIRED --

Let's begin with the latter. The new SlashDB image had a bug, which is caused by a bug in the Azure's publishing process https://github.com/Azure/WALinuxAgent/issues/1151. We have already published a corrected image to the marketplace. The following workaround is no longer requried:

  1. Log in to your SlashDB instance via SSH using credentials you set at when you launched the instance.
  2. Issue the following command

    sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Firewall settings (easy) -- START HERE --

Using Azure portal, navigate to your database resource and click on the "Set server firewall" button.

enter image description here

Check if "Allow access to Azure services" is switched on. In our testing, a SlashDB instance running in the same location as the database server (East US in our case) with this setting turned on connected without problems.

enter image description here

Firewall settings (safer)

Using the same Firewall settings panel as above, turn off the "Allow access to Azure services". Instead we will add a network route for your SlashDB instance to connect. It's preferable to do so using virtual network rules as follows.

  1. Click on the "Add existing virtual network" button in the bottom portion of the screen. A side panel will open.
  2. Fill in the required details, most important the name of the virtual network of your SlashDB instance (you can find that in its "Overview" page in Azure Portal). Click OK.
  3. Hit "Save".

enter image description here

Database Connection in SlashDB

Open your SlashDB user interface in the browser, navigate to Configure/Databases and click the "edit" button next to your database connection.

There is no need do override the connection string. Your database connection configuration should look something like this:

enter image description here

Once that's done click Save, then Close. You should now be able to successfully connect.

enter image description here

Victor Olex
  • 1,458
  • 1
  • 13
  • 28
  • Victor-- Man that's what an answer should look like. :) So since this is not urgent and I've got other stuff to work on, I'm just going to put it on hold for a week and then use the updated image. Victor thanks so much for your help and BIGTIME kudos for this amazing product! Thanks for making it!! – Jason Williscroft Dec 27 '18 at 17:57
  • Thanks. Can I quote you on that? :) BTW the new image is live now, and the DNS fix is no longer required. – Victor Olex Dec 29 '18 at 05:39
0

If your Azure SQL DB is not a Managed Instance, the SlashDB VM could not connect to it.

And please ensure the Azure SQL Database server firewall is properly connected to the SlashDB server vnet subnet's service endpoint.

The instructions about SlashDB also provides two solutions about how to solve the failed connection: enter image description here

In addition, I think you maybe you can read this link for a reference:Configure Azure VM to connect to an Azure SQL Database Managed Instance

I hope this can helps you.

Leon Yue
  • 15,693
  • 1
  • 11
  • 23
  • Let me clarify... are you saying that the only way I can play SQL Server games with my free SlashDB trial on my $14/month Linux VM is to connect it to a $1,400/month managed SQL Server instance?? No way to use a single Azure DB on a virtual Azure SQL Server? – Jason Williscroft Dec 25 '18 at 16:47
  • That should is not the case. You can use the Azure SQL, but the networking between the SlashDB instance and the database server must work. – Victor Olex Dec 26 '18 at 17:11