Query SQL Server Database from native iOS Application

后端 未结 4 1978
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 06:41

I am working on an in-house, iOS app that will need read-only access to a SQL Server with multiple databases. I know the stock answer here is \"write some web services\", bu

相关标签:
4条回答
  • 2020-12-15 07:03

    So, after much searching and trial and error, unfortunately the best (only?) way I've found is indeed using Web Services.

    Fortunately, Linq to SQL makes the WCF-creation-side incredibly easy. Once I got someone at work to walk me through setting up a Windows web server and adding the web service (and buying access to an online web server), the Windows side was up and ready to go.

    I'm still working through all of the syntax stuff on the SOAP interaction side, but keeping my different methods somewhat similar in structure allows me to tinker a little until it works. By this time, I think I've gotten it to work pretty well.

    So, both answers I got back were (disappointingly) correct. The only way to interact is through a Web Service. Even the 3rd party solutions they mentioned were really just convenient wrappers around the same type of technology. As it turns out, I'd rather have finer control over the process.

    One word of advice: Get a real, external web server. I tried doing this on a non-Server Windows VM on my iMac/MacBook Pro, and it was like pulling teeth! Once I actually got access to an external, full, stand-alone web server, the process was much more streamlined and easy. Do yourself a favor and take that headache out of the equation!

    0 讨论(0)
  • 2020-12-15 07:16

    Actually the easiest way is to create a MVC 3 or 4 asp.net web application. call the web methods. You don't need any API to pay for.

    I use SBJson to serialize domain object and then send the objects as serialized jSOn to MVC 3. It's super easy to do. I even send images with base64, so it's .net compatible.

    See my blog post with sample code: http://nickturner.wordpress.com/2012/10/09/107/

    0 讨论(0)
  • 2020-12-15 07:23

    There was a SQL ISAPI extension as part of SQLXML, but I think it has been deprecated: http://msdn.microsoft.com/en-us/library/aa226559%28v=SQL.80%29.aspx

    This was effectively a pre-built, and relatively open, web service - so I'm not sure this counts as a direct connection.

    You could also check out http://odbcrouter.com/Main

    0 讨论(0)
  • 2020-12-15 07:24

    A web service is indeed the only way, but Red Gate's written one you can reuse:

    http://www.mobilefoo.com/iSqlServerSDK.html

    http://labs.red-gate.com/Tools/Details/iSqlSDK

    It's not officially released yet, just in beta, so keep in mind that features & prices may change.

    0 讨论(0)
提交回复
热议问题