I want to connect to mysql without any php service, is that possible?
Asked
Active
Viewed 552 times
0
-
consider j2ee service, c# service, socket service – Chor Wai Chun May 29 '13 at 05:38
-
see this http://stackoverflow.com/a/7221716/276263 and http://stackoverflow.com/a/7221969/276263 – krishnakumarp May 29 '13 at 06:38
1 Answers
0
Use jdbc like this:
String url = "http://localhost/SomeDB";
String user = "someUser";
String pass = "somePass";
Class.forName(com.mysql.jdbc.Driver);
Connection con = DriverManager.getConnection(url, user, pass);
Statement st = con.createStatement();
ResultSet = st.executeQuery(SELECT * FROM Table);
String result1 = ResultSet.getString(0);
For the
Class.forName(com.mysql.jdbc.Driver);
You need the sql connect android library (jar file), just search on Google ;)

Chrisje900
- 1
- 1