本文主要是介绍java.sql.SQLException: ORA-00942: 表或视图不存在,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
从eclipse转idea几天时间,纪念一次报错,连接orcal数据库时连接都没问题,
jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@localhost:1521:orcl
jdbc.username=SCOTT
jdbc.password=tiger
但是就是报错找不到表
自己写了一个测试类都能找到,通过mybatis就找不到
测试类代码
public class testJdbc {public static void main(String[] args) {ResultSet rs = null;Statement stmt = null;Connection conn = null;try {Class.forName("oracle.jdbc.driver.OracleDriver");String dbURL = "jdbc:oracle:thin:@localhost:1521:orcl";conn = DriverManager.getConnection(dbURL, "SCOTT", "tiger");stmt = conn.createStatement();System.out.println("连接成功");rs = stmt.executeQuery("SELECT * FROM user_t") ;while(rs.next()){String id = rs.getString("id");String name = rs.getString("name");String age = rs.getString("password");System.out.println(id+name+age);}} catch (ClassNotFoundException e) {e.printStackTrace();} catch (SQLException e) {e.printStackTrace();} finally {try {if (rs != null) {rs.close();rs = null;}if (stmt != null) {stmt.close();stmt = null;}if (conn != null) {conn.close();conn = null;}} catch (SQLException e) {e.printStackTrace();}}}
}
最后发现问题原因是dao的maven没有clean。。。瞬间崩溃,搞了一下午,竟然因为这个
这篇关于java.sql.SQLException: ORA-00942: 表或视图不存在的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!