我在PLSQL Developer 里面建一张表test2 登陆方式 scott as sysdba我在java里面查询这张表时Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM test2");提示我:java.sql.SQLException: ORA-00942: table or view does not exist请高手帮我看看为什么呢?
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM test2");提示我:java.sql.SQLException: ORA-00942: table or view does not exist请高手帮我看看为什么呢?
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM test2");--------这个查询是在SCOTT用户下或者解决办法是在表名前加用户名。。;。
--dba身份登录的话,查询某个用户下的表:
select * from user_name.table_name;
--比如:
Connected as SYS
SQL> select count(*) from scott.emp;
COUNT(*)
----------
14
SQL> select count(*) from emp;
select count(*) from emp
ORA-00942: table or view does not exist