Android access to remote SQL database

This question has popped up several times. You PROBABLY can connect your android device to the SQL server directly if you deployed the MSSQL JDBC drivers to your android device and then exposed your SQL server directly to the internet. If the MSSQL drivers would work properly on Android is a completely different problem.

That is how you might be able to do it. However here is why that is a bad idea.

  1. You are exposing your SQL server directly to the internet. Unless you encrypt the data between your MSSQL server and android device it would be relatively easy for a determined hacker to sniff the TDS data stream between the device and MSSQL and reverse engineer it and steal your data. Encryption will probably make it much harder almost impossible for a attacker to steal your data. However an attacker could still launch a DOS/DDOS attack on your database directly. Not a good idea!

  2. If you are planning to connect other mobile devices (iPhone, Symbian, BlackBerry and so on) you will need to be able to create a SQL connection from those devices as well. iPhone does not support Java natively(from my memory) for example so you would need to find a way to connect iPhone to the SQL server. BlackBerry might be easier but Symbian you are going to be out of luck with. Thus you will need to almost create a custom solution for each device connecting to your database. Bad Idea LOADS of maintenance

Create a webservice or custom TCP/IP server which can manipulate your database. Connect to this webservice/service from your device. Webservices are the way to go. More than 90% of devices these days are natively capable of doing a webservice call.

Leave a Comment