I'm building an asp.net web application that uses a MSSQL Server database. I'd like to build an Android app as a mobile alternative and would like to share that same database. Is this possible, and if so what is the best way to tackle this?
-
Do read: http://stackoverflow.com/questions/15853367/jdbc-vs-web-service-for-android – Morrison Chang Mar 08 '15 at 01:20
2 Answers
if you are using the android SDK then you just need a supported jdbc driver. Try these articles to get you started:
https://capdroid.wordpress.com/2012/07/16/android-jdbc-driver-for-microsoft-sql-server-and-sybase/

- 21,737
- 8
- 62
- 86
Also look into WebApi2 since you're using the .NET platform. It allows you to build an API for both your mobile and website application (or any other). '
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
The nice part about this is that you only have to build the API once and both applications can call it in the same way. For example, you may have something like:
http://api.mydomain.com/user/123
When your website or mobile app runs a GET on that url, you'll get structured JSON data back for user 123 such as:
{
"id": 123,
"username": "myname123",
"firstName": "John",
"lastName": "Smith",
"email": "jsmith@test.com"
}
You can also use POST methods to send data to your API which your application can process and store in its database. You get the benefits of validation and security without exposing your database.
There are plenty of resources and examples of APIs from big and small companies which you can look at to get some ideas.

- 1,743
- 5
- 21
- 40