在修改数据库连接服务器后,Run As 出现下面错误
//con=DriverManager.getConnection("jdbc:mysql://localhost/rmealdb","root","123321");
con=DriverManager.getConnection("jdbc:mysql://10.6.2.89/rmealdb","root","123321");
但运行地址改为: http://local:8080/rmealserv 正常运行。
原因: con=DriverManager.getConnection("jdbc:mysql://10.6.2.89/rmealdb","root","123321");
没有标明数据库连接端口
改为con=DriverManager.getConnection("jdbc:mysql://10.6.2.89:3306/rmealdb","root","123321");
正常。