如何在Java中作为SYS连接到Oracle?

2022-09-01 09:24:20

我收到此错误:

java.sql.SQLException: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

如何修复?(我需要是)。谢谢。SYS


答案 1

试试这个 :

import java.sql as jsql
import java.lang as lang
driver, url, user, passwd = (
"oracle.jdbc.driver.OracleDriver",
"jdbc:oracle:thin:@localhost:1234:xxx1",
"sys as sysdba",
"xxx1")
 lang.Class.forName(driver)
 c = jsql.DriverManager.getConnection(url,user,passwd)

答案 2

答案已经在那里,

您正在尝试连接,但服务器允许sys

sys as sysdba

sys as sysoper

只需将用户参数更改为上面的任一

user='sys as sysdba'

user='sys as sysoper'

推荐