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

Eclipse ADT: my project doesn't work anymore (verifyError). What can I do?
Android - App locale changes and displayed orientation
Android RelativeLayout Background Color
How to decode string to UTF-8 correctly? [closed]
Widget is not appearing in widget laucher section
Set a Margin between two buttons programmatically from a linearlayout
Android: Custom CursorAdapter to alternate resources
Qt Creator: No valid kits for Android found
How to annotation order field when using XStream on Android?
Layout Resize when keyboard appear (ScrollView)
Android Webview memory increases
Out of Memory Exception - Google Map GroundOverLay
How to calculate area of Irregular polygon drawn on map fragment using Google map API V2 in android? [duplicate]
how to start a service in android
Get google apis in unsupported mobiles?
Send commands to android app from server

Categories

HOME
algorithm
eclipse
azure-stream-analytics
adal
linkedin
static
oracle-apex-5
solver
grafana
yandex
entity-framework-core
rds
vxml
nuget-package
mql5
g++
redis-sentinel
ycsb
filechannel
comsol
enterprise-architect
docx
azure-iot-hub
scsi
job-scheduling
nim
jquery-ias
jquery-callback
bulletphysics
jasmine-node
user-defined-functions
sqsh
google-earth
ntp
scrollview
turfjs
twos-complement
classcastexception
activexobject
carriage-return
mnist
numpy-broadcasting
swagger-php
salesforce-communities
jvmti
comparison-operators
doc
watchface
softmax
avcapturedevice
httr
openal
clarifai
fclose
tinymce-3
compiler-design
colorbar
excel-dna
otp
er-diagram
testrail
taocp
grails-plugin
signalr.client
mongodb-php
wso2developerstudio
synonym
respondcms
swizzling
query-by-example
project-organization
toast
pypiserver
include-guards
evolus-pencil
ember-cli-rails
atoi
alloy-ui
java-security
apache-spark-1.3
addressing-mode
cbind
grails-plugin-rabbitmq
multitasking
inappsettingskit
font-awesome-4.0.0
superscrollorama
insert-id
alice
booksleeve
curb
listitem
matlab-load
event-receiver
codebase
interprocess
application-verifier
murmurhash
lobo-cobra
software-lifecycle
commercial-application
netbeans6.1

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