【发布时间】:2020-07-28 12:56:43
【问题描述】:
我想用数据库(XAMP SOFTWRE)制作一个小型的员工管理系统软件。 软件我正在使用 NETBEANS
对于我正在使用的数据库连接: 1.JAR = mysql-connector-java-8.0.19 2. BIN = mysql-connector-java-5.1.41.
当我想输入我的信息时,我遇到了问题。谁能帮我解决这个问题?
代码:
try {
Class.forName("com.mysql.jdbc.Driver");
con1 = DriverManager.getConnection("jdbc:mysql://localhost/project1","root","");
insert = con1.prepareStatement("insert into records(idno,name,occu,dob,pn)values(?,?,?,?,?)");
insert.setString(1,idno);
insert.setString(2,name);
insert.setString(3,occu);
insert.setString(4,dob);
insert.setString(5,pn);
insert.executeUpdate();
JOptionPane.showMessageDialog(this,"Information has been successfully recorded.");
enter code here
输出结果:
加载类com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver'。驱动程序是通过 SPI 自动注册的,通常不需要手动加载驱动程序类。
2020 年 4 月 12 日晚上 11:42:04 project1.reg jButton1ActionPerformed
严重:无
java.sql.SQLException:服务器时区值“未知”无法识别或代表多个时区。如果您想利用时区支持,您必须配置服务器或 JDBC 驱动程序(通过“serverTimezone”配置属性)以使用更具体的时区值。
在 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
在 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
在 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
在 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
【问题讨论】: