My application requirement is: i have to parse data from Microsoft SQL Server 2008 to android application and as well as have to send data from android Application to server.
How to parse data from and MS SQL Server database to android app? I have done testing to send data from android app to Server.
which methods can I use? If not, is there any alternative ways to parse?
Can anyone help me? Thank you so much for reading.
Create a REST or SOAP Service with MS SQL Server as Backend. Connect to this service from your application to request or upload data. Most of those services accept and return XML data. JSON is also widely used.
Work with XML Data in Android
Related
I'm making an application for my project in which the backend database has to be on MS SQL sever 2014 and i'm making android application as front end. I really don't know any specific way to do this connectivity, i have searched alot and got to know about JDBC but i don't know how to get along with.
Your answers will be really appreciated.
You can use a webservice for this. If you'll just deploy your app locally then run your webservice locally. Use the Android AsyncTask class to connect to your database by making a post or get request via webservice. Your webservice then will be responsible for all the database query.
So the data diagram would be something like this.
Android App <----> WebService <----> Database
After the WebService gets the necessary data from the database then it could now send those data back to the android application who made the request. You can choose different ways for making a webservice like by using ASP.NET, PHP, or JAVA.
Yes, You should use WebService handle this. You can very easy use Slim (PHP micro framework ) To cope with all sorts of different language and context.
I have a script in java that works like a crawler and saves data in MySql DB. What i want to do is build a Mobile App(Andriod/ios) which will connect to mysql database retrieve results and just show it to the user.
What is the best approach to this ? I tried to use Flex UI with PHP as my server client but was hoping to know if there is a better solution ?
The fastest would be to make android fetch a page in XML, typically on the server and display its contents(If displaying contets is your desired result).
else
You need to implement a script on your server, your POST interacts with that script and inturn that script works with your database.
A typical scenario will be:
Java HTTP POST ~~~> PHP ~~~~> MySql.
PHP will as well help you encode the result in JSON and post it back to your client.
Try using jdbc or jtds library to connect android app with mysql
I used jdts library for connecting mssql db using android app.
http://jtds.sourceforge.net
For mysql jdbc might work
I want the users of my app to view an internet database, download some records of it into the database that is built in the app (not online db) and also to be able to upload some records to the online database.
I already have the database inside my app and my question is how can I make an online database that my android app could see, download from and upload to?
Android supports JDBC poorly - or let's be honest, not at all. Your best option is to create a Web server that wraps your database to a REST API. PHP is the most common language, while not the best, a lot of tutorials and snippets are available, so I would go with that. You'll have to wrap your database requests into HTTP requests and send it to the server.
For every query you'll plan on running, you'll have to create a PHP script that receives the HTTP parameters, builds the SQL query, and creates a structured XML or JSON response from the received data. This XML or JSON will than be sent to the Android client where you can parse it and obtain the data, do your syncing or such. I would suggest JSON, it's easier to read when debugging, consumes less bandwidth and has an easy to use parser in the Android API.
An easy lecture on PHP web service basics.
On using databases from PHP.
HTTP in Android.
JSON in Android.
Your online database should be on some server and you need to write a webservice to communicate your app to this online database(downloading and uploading purposes). your websrvice will also be hosted on some server. You then will be making webservice calls from your app to perform required modification to the online database.
I have been learning SQLite on Android and have done some tutorials on how to use it.
There is a question that I want to ask.
Is there a way to make my app connect to my MySQL database in a remote web server of mine so that it can read data and also write data to the database?
From what I've researched, SQLite cannot be used remotely and I would need some kind of Web service in between?
It's not easy to create a connection to MySQL from Android, if it's not impossible. With that, it's also not safe if for example someone decompiles your app they have access to your whole MySQL database if you don't limit it enough.
For those reasons, you can better use a (for example) PHP webservice to which the Android application sends all their requests. An example is available at http://www.helloandroid.com/tutorials/connecting-mysql-database.
I also suggest you use Android Asynchronous Http Client so you don't have to deal with connectivity issues and AsyncTasks yourself.
You can refer to this tutorial but you do need a web-server for it.
Request mechanism
Android App ----> webserver ------> database (mysql)
Respond mechanism
Android App <---- webserver <------ database (mysql)
Android App will use JSON or other to get the data and display it
You have to use Sqlite database and web Services both. First you have to save the data in local database i.e. SQLite database and then send this data to your server using web services and vice versa.
this link for web services
and this link for SQlite will help you understand.
Thanks.
Backend server has tables, and the android client have the same tables. Are there any way to synchronize data between them?
From your question I understand that There are tables on mobile and server both are same. Now you want to take a data from server from mobile and from to Server. Use upload and Download. When your application get started download the data from the server Process on that data after that upload that data to the server. so that both your mobile and server db remain updated.
for upload and download you can use following links:
http://blog.sptechnolab.com/2011/02/10/android/android-connecting-to-mysql-using-php/
http://www.vogella.de/articles/AndroidJSON/article.html
You have to use the JSON.