kr33
Posts: 1
Joined: Mon Jun 13, 2016 8:45 pm

Connecting to Remote SQL Server

Mon Jun 13, 2016 8:49 pm

Hi All,

I was wondering if someone could help me/guide me on the way in which I can connect to a remote sql server. The requirement I have is to commit data to a database which is located in a remote location. The input will come from external sources like a sensor/accelerometer etc.

I have Window IoT Core installed on my RPi 2.

Any help will be highly appreciated.

Kind Regards,
Kr33

tsaG
Posts: 80
Joined: Thu Jun 26, 2014 1:30 pm

Re: Connecting to Remote SQL Server

Tue Jun 14, 2016 1:07 pm

Since you can use the Windows universal apps on it, you could try this:

http://blogs.u2u.be/diederik/post/2015/ ... tform.aspx

increddibelly
Posts: 1
Joined: Wed Feb 08, 2017 6:41 pm

Re: Connecting to Remote SQL Server

Wed Feb 08, 2017 6:43 pm

Have you found a way to do this yet? It's a bit of a shame that the framework is pushing you to use Azure IOT hub and execute your business logic .NET code within Azure.

tosp4gi0us
Posts: 2
Joined: Sat Feb 18, 2017 12:22 am

Re: Connecting to Remote SQL Server

Sat Feb 18, 2017 12:56 am

Hello

Nothing like digging up old posts.

Regarding the Op's 12 month old question perhaps we should be asking is whether connecting to a remote SQL Server is the right way to commit data to a database. SQL Server is a server type application and usually lives in the datacenter. Win IoT is not a datacenter application and does not live in the datacenter. For reasons I won't elaborate on SQL Server should never be exposed to a client outside the datacenter - this applies as much to desktop applications as much as this scenario.

We need a way to bridge the SQL Server to client application and that's where web services step in. Windows Universal Applications (which we use on both Win IoT and any Windows Store device) has great support for web services. While you can use an Azure solution WCF will do fine in a home lab. There are several ways to host WCF web services including IIS, Windows Services, Windows Activation Services, or any .Net application running the server profile.

The question about whether to run the web services under WCF in your own "datacenter" vs Azure probably comes down to whether or not you have a proper datacenter and whether you want to provide the service commercially or for your own consumption. I cannot comment on how hard it is to migrate services from WCF to Azure and vice versa; but, for something simple it should not be to hard.

Given the Op is already running SQL Server hosting a WCF service should not be a problem.

Assuming you are developing using Visual Studio the ease of setting up WCF services is going to depend on what templates you have available; but, hopefully you have a "WCF Service Library" or "WCF Service Application". Once you have created and deployed the services you can "add service reference" to your Win 10 IoT project and put in the URL you deployed the services to. This will generate a bunch of classes to allow you to call functions against the host. Setting up a DataContract that supports the sensor data and a couple of OperationContracts for data access should not be to hard.

If you don't have the VS templates for WCF you can still do it; but, you will have to do more work yourself.

Return to “Windows 10 for IoT”

Who is online

Users browsing this forum: No registered users and 6 guests