连接Mysql显示找不到表
作者:互联网
Exception in thread "main" java.lang.RuntimeException: SQL执行错误???
at com.yc.dao.DBHelper.selectList(DBHelper.java:187)
at com.yc.Biz.ResfoodBizImpl.findAll(ResfoodBizImpl.java:15)
at com.yc.Biz.ResfoodBizImpl.main(ResfoodBizImpl.java:31)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'res.resfood' 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:423)
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:939)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
at com.yc.dao.DBHelper.selectList(DBHelper.java:168)
... 2 more
只需把jdbc.properties文件里的url中数据库的名字改为res63即现在使用的数据表,而报错信息中提示的Table ‘res.resfood’ doesn’t exist,为之前使用过的表,直接迁移过来,忘记改数据库名导致的
标签:jdbc,java,yc,mysql,不到,Mysql,com,连接,MysqlIO 来源: https://blog.csdn.net/weixin_44048117/article/details/100608605