connect android to mysql using jsp

时光毁灭记忆、已成空白 提交于 2019-12-06 14:18:53

I am using the following code which connects to my MySQL database from JSP page on a Tomcat server

<%! String db;
    String user;
    String pw;
%>
<%
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql:///"+db, user, pw);
        Statement stmt = conn.createStatement();
        String sql = ""; //Your SQL here
        ResultSet rs = stmt.executeQuery(sql);
        while (rs.next()) {
    %><hr>
    <%= rs.getString("<columnName")%>
    <p>
        <%
            }
        //Cleanup, just to be nice :)
        rs.close();
        stmt.close();
        conn.close();
        %>

and this jsp code connects to my database, but I don't know yet how to pass it on to Android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!