后端修改数据库_Android通过Web与后台数据库交互

2020.06.23 更新

1 背景

开发一个app与后台数据库交互,基于MySQL+原生JDBC+Tomcat,没有使用DBUtils或JDBC框架,纯粹底层jdbc实现.

以后逐步改用Spring框架,优化MySQL,进一步部署Tomcat等等,现在项目刚刚起步,还有很多不懂的东西,得慢慢来......

这几天踩了很多坑,说得夸张点真是踩到笔者没有知觉,希望能帮助别人少踩坑...

2 开发环境

  • 本地Win
  • 服务器CentOS 7
  • Android Studio 3.5.1
  • IntelliJ IDEA 2019.02
  • MySQL 8.0.17
  • Tomcat 9.0.26

3 准备环境

说一下MySQL与Tomcat的安装.

3.1 安装MySQL

这个是目前比较新的MySQL版本. 服务器系统是CentOS. 其他系统安装看这里:

  • Win10
  • Ubuntu
  • Fedroa
  • ReaHat

CentOS使用yum命令安装:

3.1.1 下载并安装mysql

sudo yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
sudo yum install mysql-community-server

3.1.2 启动服务并查看初始化密码

sudo service mysqld start
sudo grep 'temporary password' /var/log/mysqld.log

3.1.3 修改密码

首先使用root登录:

mysql -u root -p

输入上一步看到的密码,接着使用alter修改密码:

alter mysql.user 'root'@'localhost' identified by 'password';

注意新版本的MySQL不能使用太弱的密码. 如果出现如下提示:

2fc4822fda17fe72fb69a7aae5a41d1d.png

则说明密码太弱了,请使用一个更高强度的密码.

3.1.4 允许外部访问

use mysql;
update user set host='%' where user='root';

这个可以根据自己的需要去修改,host='%'表明允许所有的ip登录,也可以设置特定的ip,若使用host='%'的话建议新建一个用户配置相应的权限.

3.1.5 配置防火墙(可选)

一般来说需要在对应的云厂商的防火墙配置中开启响应端口,如图:

2fc51b672cf5d5401e1e547e219a82ca.png

d86bce524c138a938369ad651f3a34b3.png

f7de71b5cd6002a76834cda1ba5280bd.png

93ba2e1eaf76afc9501b9f542e567e75.png

其中授权对象可以根据自己的需要更改,0.0.0.0/0表示允许所有的ip.

3.2 安装Tomcat

3.2.1 下载并上传到服务器

先去官网下载,下载后上传文件到服务器:

8edfd05cef15c229bef3e3589d8dd7f3.png

2c08331486b4ef084ddd0b4f237e642d.png

笔者使用的是scp命令,使用不熟练的可以戳这里看看

scp apache-tomcat-xxxx.tar.gz username@xx.xx.xx.xx:/

改成自己的用户名和ip.

3.2.2 解压

ssh连接到服务器,接着移动到/usr/local并解压:

mkdir /usr/local/tomcat
mv apache-tomcat-xxxx.tar.gz /usr/local/tomcat
tar -xzvf apache-tomcat-xxx.tar.gz

3.2.3 修改默认端口(可选)

修改conf/server.xml文件,一般只需修改

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

中的8080端口,修改这个端口即可. 需要的话自行更改. ~~笔者这么懒的是不会更改的.~~

3.2.4 启动

运行bin目录下的startup.sh:

cd bin
./startup.sh

3.2.5 测试

浏览器输入:

服务器IP:端口

若出现:

cd31372660de353ef2585e159969a219.png

则表示成功.

3.2.6 开机启动(可选)

建议配置开机启动,修改/etc/rc.local文件,添加:

sh /usr/local/tomcat/bin/startup.sh

这个根据自己的Tomcat安装路径修改,指定bin下的startup.sh即可.

4 建库建表

创建用户表,这里简化操作(好吧笔者就是喜欢偷懒)就不创建新用户不授权了. 这是一个在本地用root登录的示例,请根据实际情况创建并授权用户.

4.1 创建user.sql

CREATE DATABASE userinfo;
USE userinfo;
CREATE TABLE user
(
    id          INT     NOT NULL    PRIMARY KEY   AUTO_INCREMENT,
    name        CHAR(30)    NULL,
    password    CHAR(30)    NULL
);

4.2 导入到数据库

mysql -u root -p < user.sql

0b16942979e88e0a1a10f8c122ff9618.png

5 后端部分

5.1 创建项目

选择Web Application:

912062ba7715aa98bc42595811739a64.png

49ed14277b387464c6685dcba848fc83.png

5.2 添加依赖库

创建一个叫lib的目录:

fbaa7fddab7433d6d4c91612ba8adc47.png

添加两个jar包(jar包在文末提供下载链接): - mysql-connector-java-8.0.17.jar - javax.servlet-api-4.0.1.jar

72f44a0122e5f3061f40bf3ba443b28d.png

打开Project Structure:

4ee7f6aef3692c535515a1a665373306.png

Modules --> + --> JARs or directories:

84b74edfe71c3310802e7f036463c7f6.png

选择刚才新建的lib下的两个jar包:

56fd11cb3fe9bc44f2240fb4159e911e.png

打勾,apply:

db01e33bbd917ce4a9bef9c6c93832e3.png

5.3 创建包与类

总共4个包

  • com.servlet:用于处理来自前端的请求,包含SignUp.java,SignIn.java
  • com.util:主要功能是数据库连接,包含DBUtils.java
  • com.entity:实体类,包含User.java
  • com.dao:操作用户类的类,包含UserDao.java

3eda3967a63a03e246e0a9c80a1d62b7.png

5.4 DBUtils

连接数据库的类,纯粹的底层jdbc实现,注意驱动版本.

public class DBUtils {

    private static Connection connection = null;
    public static Connection getConnection()
    {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            String url = "jdbc:mysql://127.0.0.1:3306/数据库名字";
            String usename = "账号";
            String password = "密码";
            connection = DriverManager.getConnection(url,usename,password);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            return null;
        }
        return connection;
    }

    public static void closeConnection()
    {
        if(connection != null)
        {
            try {
                connection.close();
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
        }
    }
}

主要就是获取连接与关闭连接两个函数.

String url = "jdbc:mysql://127.0.0.1:3306/数据库名字";
String usename = "账号";
String password = "密码";

这几行根据自己的用户名,密码,服务器ip和库名修改. 注意,MySQL 8.0以上使用的注册驱动的语句是:

Class.forName("com.mysql.cj.jdbc.Driver");

旧版的是:

Class.forName("com.mysql.jdbc.Driver");

5.5 User

User类比较简单,就是就三个字段与getter,setter:

public class User {
    private int id;
    private String name;
    private String password;
    //三个getter与三个setter
    //...
}

5.6 UserDao

public class UserDao {
    public boolean query(User user)
    {
        Connection connection = DBUtils.getConnection();
        String sql = "select * from user where name = ? and password = ?";
        try {
            PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1,user.getName());
            preparedStatement.setString(2,user.getPassword());
            ResultSet resultSet = preparedStatement.executeQuery();
            return resultSet.next();
        }
        catch (SQLException e)
        {
            e.printStackTrace();
            return false;
        }
        finally {
            DBUtils.closeConnection();
        }
    }

    public boolean add(User user)
    {
        Connection connection = DBUtils.getConnection();
        String sql = "insert into user(name,password) values(?,?)";
        try {
            PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1,user.getName());
            preparedStatement.setString(2,user.getPassword());
            preparedStatement.executeUpdate();
            return preparedStatement.getUpdateCount() != 0;
        }
        catch (SQLException e)
        {
            e.printStackTrace();
            return false;
        }
        finally {
            DBUtils.closeConnection();
        }
    }
}

主要就是查询与添加操作,查询操作中存在该用户就返回true,否则返回false 添加操作中使用executeUpdate()getUpdateCount() != 0.注意不能直接使用

return preparedStatement.execute();

去代替

preparedStatement.executeUpdate();
return preparedStatement.getUpdateCount() != 0;

咋一看好像没有什么问题,那天晚上笔者测试的时候问题可大了,android那边显示注册失败,但是数据库这边的却insert进去了.........这..... 好吧说多了都是泪,还是函数用得不够熟练.

  • 一般来说select使用executeQuery(),executeQuery()返回ResultSet,表示结果集,保存了select语句的执行结果,配合next()使用
  • delete,insert,update使用executeUpdate(),executeUpdate()返回的是一个整数,表示受影响的行数,即delete,insert,update修改的行数,对于drop,create操作返回0
  • create,drop使用execute(),execute()的返回值是这样的:
    • 如果第一个结果是ResultSet对象,则返回true
    • 如果第一个结果是更新计数或者没有结果则返回false

所以在这个例子中

return preparedStatement.execute();

肯定返回false,所以才会数据库这边insert进去,但前端显示注册失败(这个bug笔者找了是真的久......)

5.7 SignIn与SignUp

servlet包的SingIn类用于处理登录,调用JDBC查看数据库是否有对应的用户. SignUp类用于处理注册,把User添加到数据库中. 目前使用的是HTTP连接,后期会考虑添加HTTPS支持.

SignIn.java如下:

@WebServlet("/SignIn")
public class SingIn extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException,ServletException
    {
        this.doPost(httpServletRequest,httpServletResponse);
    }

    @Override
    protected void doPost(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) throws IOException, ServletException
    {
        httpServletRequest.setCharacterEncoding("utf-8");
        httpServletResponse.setCharacterEncoding("utf-8");
        httpServletResponse.setContentType("text/plain;charset=utf-8");//设置相应类型为html,编码为utf-8

        String name = httpServletRequest.getParameter("name");
        String password = httpServletRequest.getParameter("password");

        UserDao userDao = new UserDao();
        User user = new User();
        user.setName(name);
        user.setPassword(password);

        if(!userDao.query(user))//若查询失败
        {
            httpServletResponse.sendError(204,"query failed.");//设置204错误码与出错信息
        }
    }
}
@WebServlet("/SignIn")

首先是@WebServlet注解,表示这是一个名字叫SignInservlet,可用于实现servlet与url的映射,如果不在这里添加这个注解,则需要在WEB-INF目录下的web.xml添加一个<servlet-mapping>,也就是叫servlet的映射.

接着设置响应类型与编码:

httpServletResponse.setContentType("text/plain;charset=utf-8");//设置相应类型为html,编码为utf-8

HttpServletRequest.getParameter(String name)方法表示根据name获取相应的参数:

String name = httpServletRequest.getParameter("name");
String password = httpServletRequest.getParameter("password");

下面是SignUp.java:

@WebServlet("/SignUp")
public class SignUp extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) throws IOException,ServletException
    {
        this.doPost(httpServletRequest,httpServletResponse);
    }

    @Override
    protected void doPost(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) throws IOException,ServletException
    {
        httpServletRequest.setCharacterEncoding("utf-8");
        httpServletResponse.setCharacterEncoding("utf-8");//设定编码防止中文乱码
        httpServletResponse.setContentType("text/plain;charset=utf-8");//设置相应类型为html,编码为utf-8

        String name = httpServletRequest.getParameter("name");//根据name获取参数
        String password = httpServletRequest.getParameter("password");//根据password获取参数

        UserDao userDao = new UserDao();
        User user = new User();
        user.setName(name);
        user.setPassword(password);

        if(!userDao.add(user)) //若添加失败
        {
            httpServletResponse.sendError(204,"add failed.");//设置204错误码与出错信息
        }
    }
}

5.8 添加servlet到web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <servlet>
        <servlet-name>SignIn</servlet-name>
        <servlet-class>com.servlet.SingIn</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>SignUp</servlet-name>
        <servlet-class>com.servlet.SignUp</servlet-class>
    </servlet>
</web-app>

要把刚才创建的Servlet添加进web.xml,在<servlet>中添加子元素<servlet-name><servlet-class>: - <servlet-name>是Servlet的名字,最好与类名一致 - <servlet-class>是Servlet类的位置

如果在Servlet类中没有添加@WebServlet("/xxxx")注解,则需要在web.xml中添加:

<servlet-mapping>
    <servlet-name>SignIn</servlet-name>
    <url-pattern>/SignIn</url-pattern>
</servlet-mapping>

其中<servlet-name><servlet>中的子元素<servlet-name>中的值一致,<url-pattern>是访问的路径.

5.9 Hello.html测试文件

最后添加一个叫Hello.html的HTML测试文件.

<!DOCTYPE html>
    <head>
        <meta charset="utf-8">
        <title>Welcome</title>
    </head>
    <body>
        Hello web.
    </body>
</html>

6 打包发布

笔者用的IDEA,Eclipse的打包请看这里.

6.1 Project Structure->Artifacts->Web Application:Archive

7982c35839e4cdcf5a7170e9f080cc6a.png

a001f4a94ea5227c2473f8b4f2efa9fc.png

6.2 创建目录并添加模块

修改名字,并创建WEB-INF目录与子目录classes:

afd390542e38e8b1ce325ee6f11414ae.png

选中classes,添加Module Output,选择自己的web项目:

ed853136bcb8c5edc27628a758772da6.png

6.3 添加依赖库与其他文件

添加JAR包,选中lib目录后添加JAR包文件: (lib文件夹被挡住了不要在意细节哈...)

58a21c648bcbc740e41507edec1f3f66.png

接着添加Hello.htmlweb.xml,web.xml需要在WEB-INF目录里,Hello.htmlWEB-INF外面:

81edb131f7f51bd2d204b4c41ee84a16.png

6.4 打包

Build->Build Artifacts:

e6f02414e1074e4b005b88027c653fed.png

e6cb76ef133f2c340441a1a603b5f6cf.png

6.5 上传测试

打包好的.war文件上传到服务器的Tomcat的webapps目录下:

scp ***.war username@xxx.xxx.xxx.xxx:/usr/local/tomcat/webapps

注意改成自己的webapps目录. Tomcat启动后,在浏览器输入

服务器IP:端口/项目/Hello.html

笔者为了方便就在本地测试了:

1908ae4ae120c3cfc0f745d7c4303a43.png

7 Android端

7.1 新建工程

e55e71b2e1f078cca4ef0fda61ea278e.png

d09379fbb5d068a6dc103fc38ff11867.png

7.2 MainActivity.java

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button signin = (Button) findViewById(R.id.signin);
        signin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name = ((EditText) findViewById(R.id.etname)).getText().toString();
                String password = ((EditText) findViewById(R.id.etpassword)).getText().toString();
                if (UserService.signIn(name, password))
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
                        }
                    });
                else {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, "登录失败", Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }
        });


        Button signup = (Button) findViewById(R.id.signup);
        signup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String name = ((EditText) findViewById(R.id.etname)).getText().toString();
                String password = ((EditText) findViewById(R.id.etpassword)).getText().toString();
                if (UserService.signUp(name, password))
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, "注册成功", Toast.LENGTH_SHORT).show();
                        }
                    });
                else {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, "注册失败", Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }
        });
    }
}

没什么好说的,就为两个Button绑定事件,然后设置两个Toast提示信息.

7.3 UserService.java

public class UserService {
    public static boolean signIn(String name, String password) {
        MyThread myThread = new MyThread("http://本机内网IP:8080/cx/SignIn",name,password);
        try
        {
            myThread.start();
            myThread.join();
        }
        catch (InterruptedException e)
        {
            e.printStackTrace();
        }

        return myThread.getResult();
    }

    public static boolean signUp(String name, String password) {
        MyThread myThread = new MyThread("http://本机内网IP:8080/cx/SignUp",name,password);
        try
        {
            myThread.start();
            myThread.join();
        }
        catch (InterruptedException e)
        {
            e.printStackTrace();
        }
        return myThread.getResult();
    }
}

class MyThread extends Thread
{
    private String path;
    private String name;
    private String password;
    private boolean result = false;

    public MyThread(String path,String name,String password)
    {
        this.path = path;
        this.name = name;
        this.password = password;
    }
    @Override
    public void run()
    {
        try {
            URL url = new URL(path);
            HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
            httpURLConnection.setConnectTimeout(8000);//设置连接超时时间
            httpURLConnection.setReadTimeout(8000);//设置读取超时时间
            httpURLConnection.setRequestMethod("POST");//设置请求方法,post

            String data = "name=" + URLEncoder.encode(name, "utf-8") + "&password=" + URLEncoder.encode(password, "utf-8");//设置数据
            httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");//设置响应类型
            httpURLConnection.setRequestProperty("Content-Length", data.length() + "");//设置内容长度
            httpURLConnection.setDoOutput(true);//允许输出
            OutputStream outputStream = httpURLConnection.getOutputStream();
            outputStream.write(data.getBytes("utf-8"));//写入数据
            result = (httpURLConnection.getResponseCode() == 200);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public boolean getResult()
    {
        return result;
    }
}
MyThread myThread = new MyThread("http://内网IP:8080/cx/SignUp",name,password);
MyThread myThread = new MyThread("http://内网IP:8080/cx/SignIn",name,password);

这两行换成自己的ip,内网ip的话可以用ipconfigifconfig查看,修改了默认端口的话也把端口一起改了. 路径的话就是:

端口/web项目名/Servlet名

web项目名是再打成war包时设置的,Servlet名在web.xml中的<servlet>的子元素<servlet-name>设置,与源码中的@WebServlet()注解一致.

另外一个要注意的就是线程问题,需要新开一个线程进行http的连接.

7.4 activity_main.xml

前端页面部分很简单,就两个button,用于验证功能.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:orientation="vertical"
    >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="用户名"
            />
        <EditText
            android:layout_width="300dp"
            android:layout_height="60dp"
            android:id="@+id/etname"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="密码"
            />
        <EditText
            android:layout_width="300dp"
            android:layout_height="60dp"
            android:id="@+id/etpassword"
            />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <Button
            android:layout_width="120dp"
            android:layout_height="60dp"
            android:text="注册"
            android:id="@+id/signup"
            />
        <Button
            android:layout_width="120dp"
            android:layout_height="60dp"
            android:text="登录"
            android:id="@+id/signin"
            />
    </LinearLayout>
</LinearLayout>

8 测试

8.1 注册测试

随便输入用户名与密码

805c037cba640dbccec2053a758c74d9.png

查看数据库:

f2c7f28c061b751fec1ad27f1fd22d45.png

8.2 登录测试

b006ab388c9fe0249efcc38fc194d78d.png

9 注意事项

9.1 数据库用户名与密码

数据库的用户名和密码一定要设置正确,要不然会像下图一样抛出异常:

4bbb7b1fea5044c055e10262f531b007.png

在加载驱动错误时也可能会出现这个错误,因此要确保打成WAR包时lib目录正确且JAR包版本正确. 还有就是由于这个是JDBC的底层实现,注意手写的SQL语句不能错. 千万千万别像笔者这样:

e25a83148b1860e0a121bdea849eba4d.png

9.2 网络权限问题

需要在AndroidManifest.xml添加网络权限:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

9.3 防火墙问题

服务器的话一般会有相应的相应的网页界面配置,当然也可以手动配置iptables. 修改/etc/sysconfig/iptables

vim /etc/sysconfig/iptables

添加

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

重启iptables:

service iptables restart

9.4 HTTP注意事项

由于从Android P开始,google默认要求使用加密连接,即要使用HTTPS,所以会禁止使用HTTP连接. 使用HTTP连接时会出现以下异常:

W/System.err: java.io.IOException: Cleartext HTTP traffic to **** not permitted
java.net.UnknownServiceException: CLEARTEXT communication ** not permitted by network security policy

两种建议: - 使用HTTPS - 修改默认的AndroidManifest.xml使其允许HTTP连接

res下新建一个文件夹xml,创建一个叫network_security_config.xml的文件,文件内容如下

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

然后在AndroidMainfest.xml中加入:

<application
 android:networkSecurityConfig="@xml/network_security_config"
/>

即可 另一种办法是在AndroidManifest.xml直接加入一句

<application 
android:usesCleartextTraffic="true"
/>

9.5 线程问题

从android4.0开始,联网不能再主线程操作,万一网络不好就会卡死,所以有关联网的操作都需要新开一个线程,不能在主线程操作.

9.6 AVD问题

9caec97e4e1c671cb76b59b2449478c1.png

这个bug笔者找了很久,HTTP连接没问题,服务器没问题,数据库没问题,前端代码没问题,然后去了StackOverflow,发现是AVD的问题....

ab0e6ccb80fef96b07af0518dd463ba5.png

简单来说就是卸载了APP再重启AVD,居然成功了.....

10 源码与JAR包

10.1 JAR包

  • MySQL 8.0.17驱动(注意这个要与自己的mysql版本对应)
  • java-servlet-api-4.0.1

其他版本可以来这里搜索下载.

10.2 源码

Github​github.com 码云​gitee.com

11 最后

笔者小白一枚,有什么不对的地方请大家指正,评论笔者会好好回复的.

12 参考网站

1.Android 通过Web服务器与Mysql数据库交互

2.Android高版本联网失败

3.IDEA 部署Web项目

4.PreparedStatement的executeQuery、executeUpdate和execute

5.preparedstatement execute()操作成功!但是返回false

6.HttpServletResponse(一)

7.HttpServletResponse(二)

8.HttpServletRequest

9.HttpUrlConnection

10.java.net.socketexception

如果觉得文章好看,欢迎点赞。

同时欢迎关注微信公众号:氷泠之路。

97c732da79bebb3dfbfe362132627370.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值