jdbc 连接oracle成功后 执行查询语句出问题

来源:百度知道 编辑:UC知道 时间:2024/07/05 03:10:54
通过jdbc 连接oracle 成功后,执行select * from person 语句 报错

Exception in thread "main" java.sql.SQLException: ORA-00942: table or view does not exist
------------------------------
这是我的源代码
package first;
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.pool.OracleDataSource;;

public class PersonDao {

/**
* @param args
* @throws Exception
*/

// private final static String driver="oracle.jdbc.driver.OracleDriver";
// private final static String url="jdbc:oracle:thin:@localhost:1521:orcl";
// private final static String username="system";
// private final static String password="123456";

public static void main(String[] args) throws Exception {
// BaseOperation b=new BaseOperation();
// String sql="select * from person";
// ResultSet rs=b.executeQuery(sql);
// while(rs.next())

ORA-00942: table or view does not exist

报错已经非常明显了。表不存在

你这条语句拿到数据库直接运行也是这个报错“select * from book”

看看system用户中有没有这张表。就是没有找到你要查询的表吧!

你是想select * from person,还是select * from book,没看懂

import oracle.jdbc.pool.OracleDataSource;;

以上这句好像多个分号!呵呵