connect to ms sql database in a server
i am working on a app which should take data from a database on a server. it is a ms sql database. i need som开发者_Go百科e help like little code hints or some useful information.
thank you!
1) Create some ASP, JSP, PHP pages which recieve some parameters and will operate over the database (for example: create page authenticate which will accept username and password parameters and will return true or false, to make it more simple) 2) On your Android application, you should use for example HttpClient to make request to authenticate page you have created(if you have a public domain if you you don't, you can install web server on your machine, connect your Android to USB port and access your webpage using following IP: 10.0.2.2)
This is was just a simple example when your responce will containt only true or false. I would advice you also to give a look at JSON or XML parsing libraries. So on web server you should return your data encoding it with JSON or XML(sure you can also create your own protocol, everythin is up to you) and on Android you should parse it using JSON or XML parsing libs.
ALTERNATIVE
1) Create web service and call web service from Android
Give a look at some tutorials like: http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/ http://kindohm.com/post/1097012742/androidhttpclientjson.html
Google more if it's still will be unclear for you.
Good luck ;)
Create scripts on your server to communicate between the database and your app, php scripts may be? Or if you are comfortable with SOAP/ASP.NET?
精彩评论