0

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. Commented Jun 1, 2015 at 15:28
  • 2
    There 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. Commented 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? Commented 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: Commented Jun 1, 2015 at 15:33

1 Answer 1

2

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

You may also take a look on this thread

Sign up to request clarification or add additional context in comments.

2 Comments

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.
It is doable capdroid.wordpress.com/2012/07/10/… BUT not very recommended. Look at this stackoverflow.com/questions/12233145/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.