英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论