当前位置: 代码迷 >> Java相关 >> java如何连接Oracle,
  详细解决方案

java如何连接Oracle,

热度:4230   发布时间:2013-02-25 21:47:21.0
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是管理用的
  相关解决方案