错误原因是什么啊?

来源:2-2 JDBC实战---打通数据库

Alivegirl

2016-08-17 21:13

package JDBCsql;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;


import java.sql.Statement;


public class DBUTil {
 private static final String URL="jdbc:mysql://localhost:3306/imooc?characterEncoding=utf8&useSSL=false";
 private static final String USER="root";
 private static final String PASSWORD="201305";
 public static void main(String[] args) throws Exception {
  // TODO Auto-generated method stub
    //1.加载驱动程序
  Class.forName("com.mysql.jdbc.Driver");
  //获取数据库的连接
  Connection conn=DriverManager.getConnection(URL,USER,PASSWORD);
  //3.通过数据库的连接操作数据库
  Statement stmt=conn.createStatement();
   ResultSet rs=stmt.executeQuery("select * from imooc_goddess");
 while(rs.next())
 {
  System.out.println(rs.getString("user_name")+","+rs.getInt("age"));
  
 }
 }

错误解析

ed Aug 17 20:00:29 CST 2016 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.
Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'imooc.imooc' doesn't exist
 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:422)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
 at com.mysql.jdbc.Util.getInstance(Util.java:387)
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
 at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)
 at JDBCsql.DBUTil.main(DBUTil.java:21)

写回答 关注

1回答

  • 慕粉3275723
    2016-08-19 00:45:42
    已采纳

    Table 'imooc.imooc' doesn't exist ----数据库中imooc下的imooc表不存在

    Aliveg...

    可是我写的知识imooc,拿来的,imooc.imooc

    2016-08-19 17:14:59

    共 1 条回复 >

JDBC之 “ 对岸的女孩看过来”

一起领略JDBC的奥秘,为进一步学习集成框架打下良好的基础

99327 学习 · 856 问题

查看课程

相似问题