Oracle JDBC无法连接到sysdba用户。

huangapple go评论69阅读模式
英文:

Oracle JDBC cannot connect as sysdba user

问题

我在连接数据库时遇到了问题,问题出在连接 sysdba 用户上。当在 Oracle 12c 下执行相同的代码时,一切似乎正常工作,我能够成功连接作为 sysdba 用户,但是当我尝试在 Oracle 19c 下执行相同的代码时,抛出了 ORA-01017 异常。我检查过,我已经正确创建了 orapwd 文件。当我将连接方式从 thin 改为 oci 时,它可以工作,但我仍然想继续使用 thin

OracleDataSource ods = new OracleDataSource();
Properties properties = new Properties();
properties.put("user", "sys");
properties.put("password", "password");
properties.put("internal_logon", "sysdba");

ods.setConnectionProperties(properties);
ods.setURL('这里是我的URL在使用 OCI 替代 THIN 时可以正常工作');
ods.getConnection(); // 在 Oracle 12c 下正常,在 Oracle 19c 下抛出 ORA 异常。

我尝试过使用用户 "sys as sysdba",但结果仍然是相同的 ORA-01017。有人知道可能出了什么问题吗?我正在使用 ojdbc8:19.3.0.0。

英文:

I've a problem with connecting to the database as the sysdba user. When executing the same code but under oracle 12c everything seems to be working correctly, and I am able to connect as sysdba user, but when trying to execute the same code under oracle 19c there is an ORA-01017 exception thrown. I checked an I have correctly created the orapwd file. When I changed thin to oci it works but I'd like still use the thin.

OracleDataSource ods = new OracleDataSource();
Properties properties = new Properties();
properties.put("user", "sys");
properties.put("password", "password");
properties.put("internal_logon", "sysdba");

ods.setConnectionProperties(properties);
ods.setURL('here is my URL which works when OCI used instead of THIN');
ods.getConnection(); // when Oracle 12c is okay, oracle 19c thrown ORA exception.

I tried to use user "sys as sydba" but the result was the same ORA-01017. Does anyone have any idea what's may be wrong? I am running ojdbc8:19.3.0.0

答案1

得分: 1

请检查正在创建的密码文件。如果您正在使用ignorecase参数,它在Oracle 12c下仍然有效,但在Oracle 19c下无效。如果您使用此参数创建密码文件,不会出现任何异常,并且文件将成功创建,但它将无法正常工作。解决方法可能是在不使用此参数的情况下重新创建此文件。我相信这应该会有所帮助。

英文:

Please check your password file that's being created. If you're using the ignorecase parameter it's still works under Oracle 12c but it does not under Oracle 19c. If you're creating the password file with this parameter there will no exception and the file will be created successfully but it won't be working correctly. The solution might be recreating this file without this parameter. I believe it should help.

huangapple
  • 本文由 发表于 2020年4月8日 17:57:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/61097964.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定