How To connect Ionic 3 (Angular 5) app to Azure SQL database? - azure

I have an MS Access frontend working with an Azure SQL database as the backend. This all works fine.
The next step is to give some functionality to remote users on mobiles and tablets via an Ionic App.
What is the best way to make an Ionic app interact (READ/WRITE) data with an Azure SQL database?
I am just looking for an initial overview to get a starting position. I would like to keep it within MS Azure if possible.
Is an Azure App the way to go to work as the interface between the two?

There is a plugin for Ionic which allows connection to 'Easy Tables' in the Azure App Service. We found that in order to be able to connect an Access FE to the same tables that we had to make a new SQL db with the usual setup before adding the Easy Tables. If you make the Easy tables first, Azure doesn't show you the SQL database that these relate to and how to connect to it using the standard SQL ODBC connection string.

You can consider having an API which can speak to Azure DB and have NativeScript app to call the API using REST if you are considering real-time option. You can create an Azure Mobile that uses NativeScript as explained here.
To create a REST API with Azure SQL Database please consider this article.

Related

How to host in azure?

Looking for some advice on the best and cheapest way to host in azure and I’ve never used it before so I’m finding it fairly confusing if I’m honest. But here’s where I’m at...
I have a Vue.js front-end which calls an azure function back end (API in .net core using VS) which is connected to mysql workbench running as a windows service currently, which ultimately returns all data back to my front end.
I set up a free trial tonight, I’ve created a resource group and set up an azure function and pushed my API up to it. I then created an azure for mysql instance and managed to connect my DB up (again from mysql workbench running as a windows service) to my azure mysql instance and connected this also with credentials to my API.
I need to now host the Vue.js app and connect this to my azure function but how are the endpoints exposed ?
Also, I have registered a domain and I’d assume I’d have to connect this to the Vue.js app once it’s hosted but any tips ?
I need to keep this as cheap as possible.
One of the cheapest ways to host your website is using a Azure blob storage. You can set it up for static websites, I've done this a couple of times for Angular applications. blob documentation
As for exposing your API. Make sure that your Azure function has a http trigger and the correct authorization level. You can obtain an url as prescribed here.
Please let me know if you need anything else :).

How can I connect my flutter app to my azure database?

I made a database in Azure and it is updated every day with more data. But now I want to retrieve some data from the azure database to my flutter app. But do not know how to make a connection between flutter and azure DB.
Thank you!
Your flutter app cannot connect to the Azure SQL database. You need to create a REST API, which will expose data from your database to your mobile app.
You can create an API with ASP.NET CORE, Node.JS, Python, etc.
Here are some resources that can help you :
https://www.tutorialspoint.com/flutter/flutter_accessing_rest_api.htm
https://flutter.dev/docs/cookbook/networking/fetch-data
https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-nodejs

How to connect a Xamarin app to a SQL Azure DB

I have created an SQL Azure DB and I want to connect a new Xamarin app that's supposed to run on Android, to it.
I am new to Xamarin an I couldn't figure out a simple way to do it from the tutorials online.
What's the simplest way to fetch data from a SQL DB in Azure, using Xamarin app?
Answer
You'll need to create an Azure API App. The Xamarin app will use this REST API to interact with the database.
Never connect a mobile app directly to a remote database using the database's connection string, because this opens up the potential for database corruption. For example, if the mobile app user has a poor internet connection, and they are connecting directly to the database, the app may not be able to finish executing a database query. An API will ensure that no database corruption happens due to a poor internet connection.
Sample Code + Walkthrough
I have a sample app and a walkthrough here that shows how to create an Azure API App, connect it to an Azure SQL Database and how to have the mobile app communicate with the REST API.
https://github.com/brminnick/XamList
Per my understanding, you could leverage the Data access and Client SDKs
features provided by Mobile Apps in Azure App Service for a simple way to achieve your purpose. You could follow the tutorials below for getting started with the Azure mobile app:
Sign in Azure portal, Create an Azure Mobile App backend
Add your data connection and link to your SQL Azure DB, for more details you could refer to Configure the server project
Download and run the Xamarin.Android app working with your SQL Azure DB
Additionally, you could refer to Adrian hall's book develop-mobile-apps-with-csharp-and-azure for a better understanding of Azure mobile apps.

Adding an already existing database to Azure

I have created an MVC 5 web application. I have deployed it to azure but I can't seem to add the database that I am using. I know you can create a database on azure and link it to your website but is there a way to add an existing database?
There are several ways to migrate an existing SQL Server database to the Azure environment. See this Migration guide from Microsoft.
I have used the "Deploy Database to Microsoft Azure Database wizard" before and it worked very well and easy. Have a look at this guide.

Windows Azure and MVC5 - How to use same database schema for desktop and mobile versions?

I have developed an MVC5 web application which uses Code First Migrations to build out the database. Now I am attempting to develop a mobile app (using PhoneGap if that matters) that exists as a native option to access the data of the application. However, I am having trouble finding a way for the databases to work nicely together.
Ideally, I'd like to use the same database schema entirely, and just have the application and the mobile app point to it. The database is hosted on Windows Azure. The issue I'm having is that with Azure, the standard way of handling databases with mobile apps is to use an Azure Mobile Service. However, when that service creates a database, it creates its own schema named after the service, whereas the web application uses the dbo schema. So the Users table might exist in dbo.Users for the web app, but in myAppName.Users for the Mobile Service.
I've already explored this solution, which seems to mirror my problem. However, there is an additional issue. The .NET MVC5 Authentication services use dbo as the default schema and there seems to be no way to change that.
Bottom line, if I use the default schema, the mobile app cannot access the database, but if I move the tables to the Mobile Services schema, the Login/Authentication fails because the tables don't exist in the default schema anymore.
Am I missing something here? It seems like it should be a fairly common task to have a web app and mobile app accessing the same database, but I've been investigating this for days without finding a solution.
Thanks for any help you can provide.
The standard way of using a database for mobile apps in Azure is not Azure Mobile Services. I mean, I would not call it standard but just one of the options.
When Azure Mobile Services creates a database it does not create the database with its own schema. Azure Mobile Services does not have a predefined schema. You can define your own schema. The only predefined logic is the addition of the azure mobile services tenant name as a prefix to all table names. This is done to help you host multiple azure mobile service accounts in a single database. You can override this logic if you write the app in .NET. I'm not sure if that's possible if you roll a JavaScript based Azure Mobile Services account.
My suggestion to you would be to roll your own ASP.NET Web API project and host it in Azure. You can host in Azure Web Sites or Cloud Services according to your requirements. Once you have your own APIs running in Azure you should have no problem accessing the APIs from a web site or mobile app.
Hope this helps.

Resources