-2

We have the following set up:

  • Windows Mobile Device with GPRS connection
  • Windows Server PC with SQL Server 2012
  • VPN Network where both devices contained (the cell carrier routes certain IPs inside VPN)

Status:

With the above set up I can ping directly from the mobile device to Windows server internal IP via GPRS.

Question:

  • Can I create connection to SQL server from my Mobile using the server's internal IP?

My con string is:

"Data Source =xxxxxxxx,1433;Initial Catalog=xxxxx;Integrated Security=SSPI;User id=xxxxx;Password=xxxxx;Connect Timeout=15"

EDIT:

More Questions:

  • How can I implement it if yes
  • What are the pros and cons in accordance to David's comment
apomene
  • 14,282
  • 9
  • 46
  • 72
  • You can but I would strongly advise against it. Much better to have a middle tier service that interfaces between the mobile device and the database. – DavidG Oct 13 '15 at 15:21

1 Answers1

1

If you have a VPN and can ping the internal server then you can connect directly to SQL Server using the normal data access libraries available in the .Net Framework. Having said that, I would strongly advise against it. It's much preferable to have a middle tier service that interfaces between the mobile device and the database. Here are some reasons (off the top of my head) why this is better:

  • Mobile connections are inherently unstable and SQL connections are not great at handling that.
  • Having a service means you don't even need a VPN as it can be public facing (with relevant security of course).
  • If in future you decide to move form SQL Server to DocumentDB/Azure/carrier pigeon, then you need to update every single mobile device to cope with the change. If you have an intermediate server, you can just update that.
  • If database schema changes, you may break all of your client applications in one go.
  • Your middle tier can do other useful things like caching, logging etc.
DavidG
  • 113,891
  • 12
  • 217
  • 223
  • Thanks for your answer. However I can't connect using the above con string. I don't know if there is sth more I need to specify on it. – apomene Oct 14 '15 at 10:03
  • 1
    It could be firewall or SQL not listening on the correct IP addresses? – DavidG Oct 14 '15 at 10:04