com.bjsxtjava.sql.Connectionjava.sql.DriverManagerjava.sql.SQLExceptionjava.sql.StatementJdbcTest {
(String department_namelocation_id){
Connection conn = Statement statement = {
Class.()conn =
DriverManager.()String sql = +department_name++location_id+statement = conn.createStatement()i = statement.executeUpdate(sql)System..println(i)} (Exception e) {
e.printStackTrace()}{
(statement!=){
{
statement.close()} (SQLException e) {
e.printStackTrace()}
}
(conn!=){
{
conn.close()} (SQLException e) {
e.printStackTrace()}
}
}
}
(String[] args) {
JdbcTest jdbc = JdbcTest()jdbc.insertDepartments()}
}
按照视频来的,怎么有这个错误
Fri Oct 16 00:23:35 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '8)' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491)
at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1552)
at com.mysql.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2607)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1480)
at com.bjsxt.JdbcTest.insertDepartments(JdbcTest.java:23)
at com.bjsxt.JdbcTest.main(JdbcTest.java:49)
Process finished with exit code 0
怎么解