Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
x1ejm
New Member

Scheduled refresh error connecting to SQL Server datasource

Hello - I am running the latest version of Gateway on a Windows 10 Pro Azure VM which has 2 processors and 4GB of RAM. I have been using this Gateway to successfully connect to 5 x MySQL data sources for a number of years. In the past week I have added a connection to a SQL Server 2016 data and this is failing. Manual data refreshes from Power BI Desktop work fine, and the initial scheduled refresh via the Power BI Service also works fine, but subsequent scheduled refreshes fail. The error message says "Microsoft SQL: A network-related or instance-specific error occurred while establishing a connection to SQL Server." and in the error logs, error code -2147467259 is reported. I have tried Googling this code but none of the solutions match my situation. In this instance when I choose "Manage Gateways and Connections" inside the Power BI Service, all of the MySQL connections still show as "online" (which means the Gateway is still running), while the "SQL Server" connection shows as "offline". If I then restart the Gateway VM the next scheduled refresh works correctly, but then errors on subsequent occasions. Any ideas? PS - I know I am running the Gateway on a "below recommended" spec machine, but I have checked the CPU and RAM usage stats and they are nowhere near maxed out, and added to this things have been fine for years in this configuration. 

1 ACCEPTED SOLUTION
x1ejm
New Member

Hello Ibendlin - thanks for getting back to me, I appreciate it. I have worked out what the issue is and you are on the right track with your questions. Of course I didn't mention the thing that turns out is causing the problem! The supplier of the platform upon which the SQL Server is hosted required us to install a ZeroTier peer-to-peer VPN connection between the two machines and when running on Windows, ZeroTier is known to periodically drop the connection. In order to resolve this I have done two things as suggested on the ZeroTier community forum - i) I have setup a scheduled task to restart the ZeroTier service every 15 minutes, and ii) setup another scheduled task which pings the SQL Server every 5 seconds, just to keep the connection open. This appears to have worked! Thanks again for getting in touch. PS - I know from experience when searching for a solution that it is useful to have example scripts, so here's the Powershell script I'm using to ping the SQL Server - it includes useful logging which I used to check if ZeroTier is dropping the connection for a few seconds every 15 minutes as it restarts - which it is.

 

function pingtest{
# Set the name and the location of the log file
$loglocation = "[path to log file goes here]\pinglog.txt"
while($true){
# Set the name or IP of the server you want to ping
$servername = "[Server URL or IP address goes here]"
$test = Test-Connection -computername $servername -Count 1 -Quiet
$timestamp = Get-date
if ($test -eq 'true'){
Out-File -Append -InputObject "$timestamp - success" $loglocation
Write-Verbose "$timestamp - success" -Verbose
}else{
Out-File -Append -InputObject "$timestamp - fail" $loglocation
Write-Verbose "$timestamp - failure" -Verbose
}
# Set the interval in seconds to wait until the script runs again
start-sleep -s 5
}}
Clear-Host
pingtest

View solution in original post

3 REPLIES 3
v-binbinyu-msft
Community Support
Community Support

Hi @x1ejm ,

I am glad to hear your problem has been resolved, please kindly mark it as the solution. More people will benefit from it.

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_Binbin Yu

x1ejm
New Member

Hello Ibendlin - thanks for getting back to me, I appreciate it. I have worked out what the issue is and you are on the right track with your questions. Of course I didn't mention the thing that turns out is causing the problem! The supplier of the platform upon which the SQL Server is hosted required us to install a ZeroTier peer-to-peer VPN connection between the two machines and when running on Windows, ZeroTier is known to periodically drop the connection. In order to resolve this I have done two things as suggested on the ZeroTier community forum - i) I have setup a scheduled task to restart the ZeroTier service every 15 minutes, and ii) setup another scheduled task which pings the SQL Server every 5 seconds, just to keep the connection open. This appears to have worked! Thanks again for getting in touch. PS - I know from experience when searching for a solution that it is useful to have example scripts, so here's the Powershell script I'm using to ping the SQL Server - it includes useful logging which I used to check if ZeroTier is dropping the connection for a few seconds every 15 minutes as it restarts - which it is.

 

function pingtest{
# Set the name and the location of the log file
$loglocation = "[path to log file goes here]\pinglog.txt"
while($true){
# Set the name or IP of the server you want to ping
$servername = "[Server URL or IP address goes here]"
$test = Test-Connection -computername $servername -Count 1 -Quiet
$timestamp = Get-date
if ($test -eq 'true'){
Out-File -Append -InputObject "$timestamp - success" $loglocation
Write-Verbose "$timestamp - success" -Verbose
}else{
Out-File -Append -InputObject "$timestamp - fail" $loglocation
Write-Verbose "$timestamp - failure" -Verbose
}
# Set the interval in seconds to wait until the script runs again
start-sleep -s 5
}}
Clear-Host
pingtest

lbendlin
Super User
Super User

What's the network topology? how "far"  away is the gateway from the SQL Server in terms of latency and network speed?

 

As you already mentioned your gateway is woefully underspecced and running on the wrong OS.  Are you connecting to the MySQL sources in import mode or Direct Query mode?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors