I have database on a server, and I have the username and password to access to this server. My question is: how can my android app read a table from a database on a server? I know, this question was asked, but I did not found any code or any answer that explain that detailed.
4
-
You need to write a web server that exposes the data.SLaks– SLaks2015-06-01 15:28:56 +00:00Commented Jun 1, 2015 at 15:28
-
2There are actually several ways of doing this, it would help if you wrote down what you tried to do and where it didn't work out for you.Razgriz– Razgriz2015-06-01 15:29:18 +00:00Commented Jun 1, 2015 at 15:29
-
@SLaks Can you give me an exmaple or any tutorial? or in which language should i write that? and how?user3625605– user36256052015-06-01 15:31:21 +00:00Commented Jun 1, 2015 at 15:31
-
@Razgriz I need only one column from this database, I have all things(hostname, username, password and server) but I do not how to use that or how to write a program that does that:user3625605– user36256052015-06-01 15:33:28 +00:00Commented Jun 1, 2015 at 15:33
Add a comment
|
1 Answer
Basically you need a Web Service that read/write into your DB. Android then read the data through JSONObject and parser.
Direct connection through JDBC is insecure.
Below is tutorial on How Android connect to mySql on server
- http://www.tutorialspoint.com/android/android_php_mysql.htm
- http://www.helloandroid.com/tutorials/connecting-mysql-database
- http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/
You may also take a look on this thread
2 Comments
user3625605
thanx, is JDBC easier? If yes, then can you give me tutorials of that, because the security is at the moment not very important for me. I need to write my program only in java, I do not need php.
stuckedunderflow
It is doable capdroid.wordpress.com/2012/07/10/… BUT not very recommended. Look at this stackoverflow.com/questions/12233145/…