iOS (Swift) project needs to read an Azure SQL database - ios

I am creating an iOS project that needs to read a SQL database in Azure. I have the database Server location, port, username, and password. I don't need to write to the database, just read it. I am more familiar with Firebase or Parse and have never used Azure. How do I even go about starting this? I tried the sample project that Azure makes for you but I don't have any tables? Do I need this? Any help would be welcome.

Azure Mobile App Service can connect with your existing SQL database
this thread explains the process where you use the existing SQL database. With this option Azure manages most of the inner workings for you.
If you want to build the Rest API from "scratch" using your existing SQL database You have some more options:
Azure API Management allows you to publish API's securely and at scale, A server less Azure Function like the example in this article Rest API with Azure Functions and Azure SQL Database or build a rest API using an Azure Logic App which doesn't require you to write code. You could also use Nodejs or many other tools you just need to evaluate what would work best for your use case.

Related

TFS database project for both Azure SQL database and on premises with multiple filegroups

I am working on a project to replicate an application that currently runs on premises to an Azure SQL Database. For the foreseeable future, the application will have to run both on site and on Azure. The project is stored in TFS, and multiple filegroups are specified. Development is ongoing. Is there a way I can maintain this as one project in source control, given that Azure SQL databases only have a primary filegroup? I feel like I can't be the first person in this situation, but I haven't found a decent solution yet.
I'm fine with the Azure database only running on primary, but that is not an option for the local database. This is not for a single deployment, I would like to continue to deploy changes both locally and to Azure from source control. I may be asking for too much here, I just really really want to avoid dual maintenance, when there are a number of teams involved.
Thank you!
You have two options:
Add manual SQL Statements to setup Filegroups on your on-premises SQL Server that don't run against SQL Azure
Use a new feature of Azure named SQL Managed Instances. This is fully managed SQL Server instance running in Azure that supports all features of SQL Server such as filegroups. Don't go installing your own SQL Server on IaaS. That's not necessary anymore with this new feature.
There is no way to use multiple filegroups in Azure SQL Database. If you want to move your database to the cloud and keep the ability to use multiple filegroups, please consider setting an Azure VM with SQL Server on it. Another option would be to change your application so that it does not use SQL filegroups.
As for the replication, please consider SQL Server replication or Azure Data Sync. Azure Data Sync requires an Azure SQL database. It is slower than SQL Server replication but it can handle conflicts.

Store UmbracoIdentity data in SQL Server

I have implemented Umbraco using UmbracoIdentity for membership and everything was going fine until I deployed my solution to an Azure Web App. On azure I am getting permission errors because UmbracoIdentity is using a SQL Server CE database stored in the App_Data folder.
For reference the error I am getting is:
Exception type: SqlCeException
There is a file sharing violation. A different process might be using the file. [ ...\wwwroot\App_Data\UmbracoIdentity.sdf ]
My Umbraco data is being stored in an SQL database and I would like to store my UmbracoIdentity membership data here as well. I would appreciate any help in how to setup SQL Server as the user store for membership data.
You need to implement the IExternalLoginStore.cs interface and then configure the application to use it. It should be fairly simple to implement as you can use the SQL Server CE implementation as an example. I've done one for Azure Table Storage - you can check the Readme at https://github.com/alindgren/UmbracoIdentity.AzureLoginStore to get an idea of how to configure the app to use a custom external login store (which for me was the least obvious part).

Can I use Sql Server Database from iOS?

There are a lot of ways to have a database on server ( I can use my own server or I can use MS Azure (for Azure I found REST API Description https://msdn.microsoft.com/en-us/library/azure/gg715283.aspx , but I didn't find a way to add some rows to a table or to get information from the table)), but I want to edit the database and get proper rows from the server database from iOS code without having server API. There are a lot of ready solutions such as Backendless.com , but they are not stable.
So is there any way to connect to the remote SQL server database on the remove server or to MS Azure database and to edit rows and fetch data?
May there are some framework for iOS to do than? (for example in .Net there are Linq framework and Entity Framework).
In your question, you linked to a management API for SQL Database service - this has nothing to do with data manipulation; it's strictly a management API for dealing with servers and databases.
If you want to direct-connect from an IOS app to SQL Database Service (or SQL Server in a VM), you'd need to find a client library for IOS (and recommendations of such a library are not in scope for StackOverflow). There is no native SQL Server client library specifically provided through the Azure SDKs / APIs.
Outside of a native client library, there is Azure Mobile Services, which provides an API stack specifically designed around use by mobile apps (whether IOS, Android, Windows Phone, or even JavaScript). The API stack provided here, by default, gives CRUD operations for SQL Database tables. Additionally, it supports adding custom API calls, where you have complete control of your API calls.
Any other API stack would require you to choose the stack and run it yourself (whether in a Linux or Windows VM, Cloud Service, or Web App - there's no single right way to do this).
Documentation for Azure Mobile Apps (and related API feature, such as monitoring) is here.
Since you are developing in Azure consider automatic REST API from SlashDB, which is available from their Marketplace.
https://azure.microsoft.com/en-us/marketplace/partners/vte/slashdb-slashdb-azure/
SlashDB reflects the entire database as URL-linked structure so a lot of queries need not even be written. It supports SELECT, INSERT and UPDATE. In addition to that it allows for defining an API end-point to call a stored procedure or return results of a SQL query.
Disclosure: I am the founder and CEO of the company behind SlashDB, but you don't have to take my word it - just try it.

the reason not to access directly from xcode to mssql?

I am planning to build an iOS app with using DB(Ms-Sql).
However, people recommends not to access DB from Xcode.
They recommend me to use php or asp for accessing db through a webpage.
I want to know the reason.
Also I am going to use DB only for (view) select line (not insert, update nor delete).
so is it possible to access directly to db for viewing purpose only?
thank you
It's generally bad for an application (mobile, web, any client) to directly have access to any database for security issues. Clients really should not be accessing the database, which is often holding very private/secure data. It opens up vulnerabilities (i.e., sql injection attack).
A set of web services written in php or java or some back-end technology is a more secure, scalable system. These web services can connect to the database and retrieve data. Your iOS application can call the web services and receive the data..for example in the form of XML or JSON.

Accessing an external SQL database in iOS

I am writing an iOS application that needs to access data from an external SQL Server 2005 database. I already have a website that accesses the same data.
I usually access the SQL server database using .NET along with stored procedures for security reasons.
I need to populate an array that will itself populate another TableViewController.
As I'm fairly new to the whole iOS thing, kindly let me know how I can do this. If it's possible, please suggest the syntax or Google keywords for this.
I'd recommend making a simple WCF .NET REST Service that queries your database and returns what you need.
I'm pretty sure your iOS app will not be able to connect to it directly.
Check out the following;
http://msdn.microsoft.com/en-us/library/bb412178.aspx
http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide
The code project tutorial is very easy to follow. And you can download the project code.
It sounds like you will want to make an API to access your database and you can access it through web requests. Essentially you will be performing web requests and respond from your site in json or xml where within your iOS client side code you can parse that and do what you need with it.

Resources