cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver II
Resolver II

Connect to MS SQL Server 2014 without gateway

Trying to figure out how to connect to my MS SQL 2014 server using JSON since I cannot use FOR JSON.

 

Using a static JSON file is simple enough, but I need be to able to update that JSON data as the SQL Server is updated.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver II
Resolver II

Re: Connect to MS SQL Server 2014 without gateway

Not solved and do not believe it can be solved.

View solution in original post

4 REPLIES 4
Highlighted
Resolver II
Resolver II

Re: Connect to MS SQL Server 2014 via direct query (or import?)

So I know I can get table data using PowerShell using the following basic code:

 

cls

#--Establish connection to SQL Server--#
$Instance = "SERVERSQLC10\SERVERSQLC10"
$connectionString = "Server=$Instance; Database=DEQ_DB; Integrated Security=True;"

#--Main Query--#
$query = "select * from RunData"

$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString

$connection.Open()
$command = $connection.CreateCommand()

$command.CommandText = $query

$result = $command.ExecuteReader()

$table = New-Object "System.Data.DataTable"

$table.Load($result)

$table | select $table.Columns.ColumnName | ConvertTo-Json

$connection.Close()

This will give me the JSON output for a table.  But I would have to manually do the updating myself.

 

I want to be able to click on the refresh tab in power bi and gather the data without having to use a gateway.

Highlighted
Community Support
Community Support

Re: Connect to MS SQL Server 2014 without gateway

Hi @tkrupka ,

Unless data source is cloud data sources like Azure SQL Database, others all need a Gateway for refresh.

And you might need a data gateway if your data sources are behind a firewall, require a VPN, or are on virtual networks.

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Community Support
Community Support

Re: Connect to MS SQL Server 2014 without gateway

Hi @tkrupka ,


Is this problem solved?


If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.


If not, please let me know.


Best Regards
Icey

Highlighted
Resolver II
Resolver II

Re: Connect to MS SQL Server 2014 without gateway

Not solved and do not believe it can be solved.

View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors