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.
Related
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
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.
I am using classic Azure portal and it does have Mobile services.I was able to create mobile service and run javascript(Node backend) backend code for sending push notifications connecting notification hubs.But in the new portal I am trying to do the same that is creating a new mobile service and run Javascript code (Node backend) for push notifications.As expected I am unable to find mobile services as old mobile service is now Mobile App.I am exploring Mobile App under App services but unable to find a option to create new scheduler that runs a Node script.I am only able to create a web job.Is it not possible to create a scheduler that runs Node script in new Azure?
Generally speaking, you can build up your own Node.js application with several functionalities you need, and expose them as HTTP REST APIs. Then you can use new Scheduler jobs on new Azure protal (https://ms.portal.azure.com) to call your own APIs in a schedule.
Please refer to https://azure.microsoft.com/en-us/documentation/articles/scheduler-intro/ for more info.
I have been doing quite a bit of research into Azure's various offerings and what they can do, however, it is quite hard to figure out how they might fit together. I have set up a Mobile Service to act as my mobile app's back-end, managing push notifications and data storage etc. This populates a SQL database I have provisioned, all good so far. However, I would now like to display this data in a dashboard type web app. Do I create a private API and host it on another Azure App Service and call it from a separate web app which populates a dashboard, or populate the dashboard directly by querying the SQL database? Not sure of the security implications of either set up, or implementation issues?
Azure App Service can combine both mobile and web components. You didn't mention the preferred language, but ASP.NET (MVC5) and Node.js are supported for the mobile component.
If you have not started using the Mobile Service in production, add the Mobile Apps SDK to your website, update the client SDK to point to the Mobile Apps SDK and just have one site.
Refs for the Server SDKs:
* node
* ASP.NET
Your best bet here is probably to create an empty Web App Service (Website) and have the Mobile Service populate the data on this website, in order to visualize it.
So keep the Mobile Service you have now, and connect it to a new website.
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.