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

Am I getting the steps right for verifying a user's Android in-app subscription?
Live Wall paper force closes
requestlayout, invalidate behaviour
Mobile website text is messed up on Android devices
ScheduledExecutorService vs Timer vs Handler
How to enable/disable airplane mode?
Android Multiple image move resizing issue
How to convert text of a TextView to bitmap in Android?
Android custom keyboard xml file [duplicate]
Android Image Resizing and Preserving EXIF data (Orientation, Rotation, etc)
web.config rules to force open .vcf on Android Chrome
Android Notification PendingIntent Extras null
Published App.. Unable to figure out how to locate it [duplicate]
Does IntelliJ packs “test file” along with the application in APK
How to hide combined bar or status bar totally in android 4.0 mini pc?
Adb can't find my device

Categories

HOME
embedded
awk
eslint
ggplot2
amp-html
nunit
character-encoding
zend-framework
static
mysql-workbench
serialization
knitr
seo
dojo
pyqt4
jax-ws
discrete-mathematics
vimdiff
xcodebuild
atlassian
cumulocity
azure-powershell
coin3d
chargify
delphi-xe5
solrcloud
microsoft-ocr
ksh
hta
fable-f#
sqsh
record
testbed
angularjs-material
hunspell
arduino-ide
roblox
openalpr
graphhopper
cd
projects-and-solutions
opensmpp
urlsession
signals-slots
avcapturedevice
memory-mapping
dapper-simplecrud
gitlist
sonarlint-eclipse
reportservice2010
vugen
reindex
lsyncd
baidu
django-1.10
rsa-archer-grc
materialized-path-pattern
chromium-os
grails-plugin
google-cloud-console
iotivity
tinkerpop3
http-status-code-401
ikiwiki
uiactionsheet
createprocess
cycle2
asyncdisplaykit
atan2
sql-server-data-tools
snackbar
user-permissions
webmatrix-3
administration
sonarqube-5.0
deform
post-commit-hook
appserver
mintty
renderer
gae-quotas
koala
accesscontrolexception
spring-3
inputmismatchexception
asdf
epiceditor
faye
subgraph
lambdaj
isa-swizzling
stress
codebase
facebook-iframe
rowlex
ajax-polling
web-garden
nstokenfield
wcf-instancing
interop-domino
fail-fast-fail-early
blind

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App