日期:2014-05-20  浏览次数:20686 次

java怎么连接Oracle,急啊
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "sys";


  try {
Class.forName("oracle.jdbc.driver.OracleDriver"); //Oracle驱动程序
con = DriverManager.getConnection(URL, USERNAME, PASSWORD);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
  报的错误是:java.sql.SQLException: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

------解决方案--------------------
不能用sys连,sys是管理用的