android


How can I interface an Android app with SQL Server?


This is my problem:
I have to make an Android app that recover some data from an existing database situated on a Microsoft SQL Server installation on Windows Server 2003. I don't know so much about server-side programming languages, so I'm searching on the Internet, and I've found that I have to use a Web Service between my app and the ASP Classic page that connect to the database.
I also found that I have to use SOAP to send data to the server with my app, using the ksoap2 library on Android, and I found how to configure it on the client side. But I can't find how to configure the WebService and which format is better for interfacing my app and the ASP Classic page.
It's very easy, actually. All what you need is to create a webservice which will display the results in JSON format. Then you need to run an HTTP request from your Android app in order the get a JSON array containing JSON objects and then you will have your data from your database.
For example: the webservice will have a function written in ASP with a SELECT statement. Before your return the result, you need to encode it in JSON. Check out JSON Encode (MSDN).
The Android app will connect to the web service link and simply retrieve the JSON encoded data. I'll put you in the right way. You just use a snippet like this one to get data from the web service:
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://yourwebservice.aspx", new AsyncHttpResponseHandler() {
#Override
public void onSuccess(String response) {
JSONArray jarr = new JSONArray(response);
for(int i = 0; i < jarr.length(); ++i) {
JSONObject jobj = jarr.getJSONObject(i);
// Do your things...
}
}
});
Create a RESTful web service in Web API or WCF. Web API will communicate with the database and your Android application with communicate with the web service.

Related Links

how can i create directory using DocumentsContract.CreateDocument on android kitkat?
Android GridView scrolling with ImageButtons
ShadowIntent is null - Robolectric 3.0
allow access to devices not asked, in one plus 2 phone, when downloading app from google store
Android - Listening to a locale change without static variables
Printing strings on screen
Back Button (activity) Return To Fragment
How to change icon and gravity of Navigation Drawer?
Capture image on current drawing state
ANDROID_HOME not set (VSTS agent running as service on OS X)
How can I override uses-feature and uses-permission
Get a TextView in an AsyncTask - Android
App is not running, showing error A/libc: Fatal signal 11 (SIGSEGV) at 0x00000e20 (code=1), thread 8068
How can I create a Location in an android Unit-Test?
drawing cache returns the same Image
File Modification check on Android

Categories

HOME
shell
kentico
localization
prism
github-for-windows
gpu
rdbms
jmx
rsa
rendering
appcelerator
hpc
tvos
pcl-crypto
openpyxl
watson-conversation
emoji
eip
heat
coin3d
package.json
symfony-2.8
asp.net-mvc-viewmodel
google-picker
sse
connector
windows-xp
dpdk
dataflow-diagram
react-toolbox
tosca
jboss6.x
maze
beautifier
delimiter
underscore.js
inversion-of-control
google-cast
mobx
wacom
hibernate-search
magento-1.9.2.4
jpad
lpsolve
smoothstate.js
clang++
oim
dapper-simplecrud
flask-restful
httrack
serde
tinymce-3
singleinstance
bbpress
payload
restore
autosar
winusb
webjars
preprocessor
envi
mongodb-php
vorpal.js
database-relations
beanstalk
asyncdisplaykit
custom-errors
boomerang
wiredep
lazybones
slash
vacuum
sha512
java-security
boost-program-options
browserify-shim
teaspoon
raygun
template-deduction
malformedurlexception
extjs2
decoupling
websphere-esb
synapse
ecslidingviewcontroller
sphinxql
isqlquery
model-driven-development
printdialog
css-reset
diem
apache-abdera
panda3d
frameworkelementfactory
monotouch.dialog
extconf.rb
apache-whirr
stress
urlrewriter
relative
exponentiation
entitydatasource
w3c-geolocation
quotation-marks
load-time
ajax-polling
tabpanel
request-headers
cfwindow
data-mapping
skype4java
software-lifecycle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App