locked
Connect Android Studio to Azure SQL RRS feed

  • Question

  • I want to build an android application for patients which will be developed using Android Studio. Hospital software is designed using Visual Basic. Currently it uses MS SQL SERVER for data storage.

    So, the data required for the working of patient portal app will be uploaded to cloud from the local server in hospital. The same could be accessed using patients app which is a android based mobile application. 

    As I have zero experience in azure and cloud, I will need exact tutorial suitable for this integrated working of Android studio, Visual Basic and SQL SERVER in cloud. 

    Connection procedure of Android Studio to Azure SQL is not available any where. I found a tutorial of Android studio using azure mobile app back end. But I need to connect Android studio to Azure SQL, not to the Azure mobile app back end. 

    Can I get any help to make connection between Android Studio and Azure SQL?

    Friday, February 14, 2020 6:56 AM

All replies

  • Hi Fathima,

    We have quite a few mobile tutorials examples you can follow. There are a couple components to this in additional to the database platform. There is the Mobile Web back-end where you can select the desired runtime, and serves to connect the hosted application with the database and the mobile client, and there is the mobile client (Android or iOS) component. There is no direct connection to Azure SQL Database, as all the existing tutorials have been updated to leverage mobile web back-end. Please see: How to connect sql azure with android app and sql server

    The challenge I see is that the Android example use Node for the mobile web back-end, so you will need to interpret the tutorial and implement your own solution but, there is sufficient detail to help you understand how the components and services work together to provide an end-to-end solution. The database connectivity functionality is built into the Azure Mobile Web service. The Android mobile tutorial uses Android Studio by default. I realize that you are looking for a direct connection to an Azure hosted SQL Database. To help me understand your solution in greater detail, is there going to be an on-premise hosted application the mobile device needs to connect with? The first challenge I see is the networking element of the firewall for the Azure SQL Database. With a direct connection to the database, you will need to add the Public IP address for each mobile device that is needing to connect. There is no way to open up the public service endpoint for the database without adding the Public IP for every client needing to connect.  

    With additinal details about your solution, more specific details can be provided about what is achievable and what is not.

    Regards,

    Mike

     

    Sunday, February 16, 2020 7:53 PM
  • Hi 

    Please convey if you were able to go through these documents. We have proposed the last reply as an answer, please mark it as an answer or get back to us with more questions.

    Thanks
    Navtej S

    Tuesday, February 18, 2020 2:45 PM
  • I've already visited the link you suggested: https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-android-get-started 

    It is to connect Android Studio with Azure Mobile Back-end. Not with Azure SQL. I need to get connection between Azure SQL and Android Studio. Then, as you said I will need to interpret the tutorial and implement your own solution. It's not possible as I have zero experience with Azure and Cloud Environment. 

    Finally:  with a direct connection to the database, you will need to add the Public IP address for each mobile device that is needing to connect. Which means we need to add the IP addresses of all users who will be using the app? It's impractical. 

    I've read that with the help of jtds jar file and add code to build.gradle file, I can connect android studio with Azure SQL. Setting firewall rule in range 0.0.0.0 to 255.255.255.255. Is there such a way to get connection?

    Tuesday, February 18, 2020 5:43 PM