Forum Xamarin.Android

Cannot establish connection to MS SQL server on Android device

GNA1996GNA1996 Member ✭✭
edited May 2019 in Xamarin.Android

I have made a simple app where a user can input their username and password and if their credentials are in the MS SQL database, clicking the login button will direct them to the next page. I established the connection to MS SQL server directly with connection string(yes, I know this is not the best way of doing things). The app works fine on the emulator but not on an android device. I am getting this error: SNI_ERROR_40. CMIIW, I think this error is caused by the failure of opening a connection to the MS SQL server? Any idea why I am only facing this error on the device and how to go about fixing it?


  • jezhjezh Member, Xamarin Team Xamurai

    You can try to find the solution by the following steps:
    1. Make sure SQL SERVER is up and the instance you try to connect is running.
    2. Your system Firewall should not block SQL Server port.

    For more details, you can check:

  • GNA1996GNA1996 Member ✭✭

    Hi @jezh

    I have already done that as I previously had issues connecting to the SQL server from my PC. Now the connection is fine on my PC and the emulator, but not on an android device. Do you think it is an android issue or is it related to the server? I'm sorry this is my first time making an app and working with an SQL server so I really am stumped as to what could be causing this.

  • jezhjezh Member, Xamarin Team Xamurai
    edited May 2019

    You need to make sure that the SQL server and the phone network are on the same network segment.
    You can try to share a server url and let the mobile to visit the url, if the mobile could reach, this means they are in the same network segment.

Sign In or Register to comment.