I wanna to connect android app to SQL server 2012. I have a database in SQL server and need to insert and retrieve data from it. And I need step by step procedure because am new to SQL server and android database connectivity. Any help would be welcome and appreciated
4
-
1Don't, at least not directly. This is for two reasons. First off, that would require you to expose your database to the internet, that's an unnecessary security risk. Secondly, it would require you to put your password in the app, and that would make it trivial to directly connect to your database and screw with your data. Instead you need to use a webservice to separate the two. But a step by step guide is WAY to broad for this website.Gabe Sechan– Gabe Sechan2015-03-08 09:08:02 +00:00Commented Mar 8, 2015 at 9:08
-
Can you explain how to connect web service and database??iSrinivasan27– iSrinivasan272015-03-08 09:10:41 +00:00Commented Mar 8, 2015 at 9:10
-
Your database will provide a library to do so, or your programming language will. The exact answer depends on language and database implementation.Gabe Sechan– Gabe Sechan2015-03-08 09:12:18 +00:00Commented Mar 8, 2015 at 9:12
-
How do i find that library in database and how to connect web service and database... If any possible give samples library in sql server and referencesiSrinivasan27– iSrinivasan272015-03-08 09:36:26 +00:00Commented Mar 8, 2015 at 9:36
Add a comment
|
1 Answer
One possible solution might be using a .php file on your server that handles the database operations (i.e. SELECT, INSERT, UPDATE etc.). In your app you only have to call this .php file via URL with the right parameters using a ServiceHandler:
ServiceHandler serviceClient = new ServiceHandler();
String json = serviceClient.makeServiceCall(YOUR_PHP_URL, ServiceHandler.POST, params);
Here are two good tutorials that I used myself: