开发者

how to connect android and mysql server?

I want to get the details from online mysql databse in android. I have wrote a php script to get the details form mysql database and convert the result as json string and extract the details in android using some so开发者_StackOverflow社区rt of methods. I am new to android development I think there should be some simple way to do this. if so please let me know.


You can use plain JDBC API with JDBC connector, only one I know is working is mysql-connector-java-3.0.17-ga-bin.jar. Bear in mind that exposing a database directly in the cloud is a serious security risk, as passwords and connection details travel without encryption. Best solution would be to implement a REST or SOAP web service with proper scheme.

Check this answer with an example of JDBC API connection


An other approach is to use a Virtual JDBC Driver that uses a three-tier architecture: your JDBC code is sent through HTTP to a remote Servlet that filters the JDBC code (configuration & security) before passing it to the MySql JDBC Driver. The result is sent you back through HTTP. There are some free software that use this technique. This is secure because the database is never exposed directly and you may use SSL. Just Google "Android JDBC Driver over HTTP".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜