我的数据库表没有插入此信息,我无法看到错误的位置,以及插入是否成功。请帮忙!
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/payroll_system", "root", "");
PreparedStatement ps = con.prepareStatement("INSERT INTO payroll_system.employee_info(employeeID, FirstName, LastName, Admin,DOB,Address,Email,HourlyRate,Gender,ALeaveBalance,SLeaveBalance,ActiveStatus,Role,BSB,BankName,AccNumber,SuperNumber,SuperCompany) values(?,?,?,?,?,?,?,?,?,?,?,1,?,?,?,?,?,?)");
ps.setString(1, employee_id);
ps.setString(2, firstName);
ps.setString(3, lastName);
ps.setString(4, admin);
ps.setString(5, DOB);
ps.setString(6, address);
ps.setString(7, email);
ps.setString(8, HPR);
ps.setString(9, gender);
ps.setString(10, ALB);
ps.setString(11, SLB);
ps.setString(12, Role);
ps.setString(13, BSB);
ps.setString(14, BankName);
ps.setString(15, BAN);
ps.setString(16, SAC);
ps.setString(17, SAN);
ResultSet rs = ps.executeQuery();
st=rs.next();
if(st) {
out.println("Account successfully created!");
RequestDispatcher rd = request.getRequestDispatcher("index.html");
rd.include(request, response);
}
else{
RequestDispatcher rd = request.getRequestDispatcher("changePassAdmin.html");
rd.include(request, response);
}
}catch(Exception e)
{
e.printStackTrace();
}
out.close();
答案 0 :(得分:0)
2bf275350996 gcr.io/google_containers/podmaster:1.1 "/podmaster --etcd-se" 26 minutes ago Up 26 minutes k8s_controller-manager-elector.5b0f7cea_kube-podmaster-192.168.111.32_kube-system_3b8350635fe89ab366063da0be8969fd_1f370f8c
c64042286744 gcr.io/google_containers/podmaster:1.1 "/podmaster --etcd-se" 26 minutes ago Up 26 minutes k8s_scheduler-elector.bc3d71be_kube-podmaster-192.168.111.32_kube-system_3b8350635fe89ab366063da0be8969fd_c9ecb387
81bd74d0396a gcr.io/google_containers/hyperkube:v1.1.2 "/hyperkube proxy --m" 26 minutes ago Up 26 minutes k8s_kube-proxy.176f5569_kube-proxy-192.168.111.32_kube-system_8a987aa8c76c4d76bd80ccff5b65ffea_840d8228
39494ed8e814 gcr.io/google_containers/pause:0.8.0 "/pause" 27 minutes ago Up 27 minutes k8s_POD.6d00e006_kube-podmaster-192.168.111.32_kube-system_3b8350635fe89ab366063da0be8969fd_36b73b1d
632dc0a2f612 gcr.io/google_containers/pause:0.8.0 "/pause" 27 minutes ago Up 27 minutes k8s_POD.6d00e006_kube-apiserver-192.168.111.32_kube-system_86819bf93f678db0ee778b8c8bb658dc_815c6627
361b297b37f9 gcr.io/google_containers/pause:0.8.0 "/pause" 27 minutes ago Up 27 minutes k8s_POD.6d00e006_kube-proxy-192.168.111.32_kube-system_8a987aa8c76c4d76bd80ccff5b65ffea_7a6182ed
仅用于查询,您需要编写
executeQuery