Main Site Documentation

Connecting to SQL Server


Does anyone have any suggestions on connecting to a SQL server?
It is my intent to purchase a Cobra starter kit, but it seems to go out of stock as quickly as more becomes available!
I need to be able to insert/update/select (i.e. not just select) in the tables.
I have posted a similar question over on Stackoverflow, and someone suggested setting up a webservice with SQL, but I have yet to try that (since I have don’t have a board yet!)
The webservice approach seems fairly simple and direct, but has anyone found an even more direct approach?


Well, you could create a SQL REST API if you wanted with a LAMP stack, just make sure you have some good security on that.To query, you’d have an API client running on the Cobra which would make HTTP requests to the REST API.


Yep, like Chris said, the way is to make an API to expose what you need and then use that to access your database. FEZ has encryption so you can encrypt your data if you are worried about security.


If you are exposing any of this to the internet, use the highest level of encryption you can. If it’s a production DB, do not expose it all.


I would rather go for a webservice approach if its available?

So Chris and Gus; are we able to consume webservices straight out of the box? Can we just add an external refrence to a webservice and start using it?


The way i did is created an app that is running on my SQL-server and listens for TCP messages send by the cobra. The app uses LINQ to insert the data into the SQL tables. I don’t see the advantages of using a webservice.


One advantage would in my opinion be that the data is transported over HTTP on a solid and well documented technology (SOAP). Over HTTP the microcontroller could reach webservices directly through firewalls.


DPWS is supported on fez cobra but using web services needs some intense programming and take a lot more resources that what we originally talked about
See Microsoft examples in SDK