Connect to MSSQL from Android via vpn

nrrrnrrr Member

Hi, I have a question about connecting to a database that runs on a server computer. When I access this database, I need to connect to a VPN and then use the connection string to connect to this database.
I use Visual Studio 2017, Xamarin, GenyMotion Version 3.0.0

str = "Data Source =; Initial Catalog = SerBet; User ID = Project; Password = XX";
SqlConnection conn = new SqlConnection ();
conn.ConnectionString = str;
conn.Open ();

When I run the emulator, everything works the way it works. When I run my app on my phone, the connection will not take place.
catch (SqlException ex) = Snix_Connect (provider: SNI_PN7, error: 40-SNI_ERROR_40)

can someone give me an advice what could be the diference between emulator and real run from the android device?


  • JohnHJohnH GBMember ✭✭✭✭✭

    The emulator will use your PC's network connection, the android device will use its own network connection and I am guessing that endpoint isn't reachable on the physical device.

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭
    Connecting directly to SQL Server from a mobile device is a Bad Idea.

    The accepted method is to expose a REST API on the server which accesses the database locally and presents API endpoints to the mobile app.
Sign In or Register to comment.