简体   繁体   English

ORA-01017:无效的用户名/密码; 登录被拒绝

[英]ORA-01017: invalid username/password; logon denied

I am using Oracle 11g with eclipse oxygen, i am trying to setup Jdbc connection, and i am using the connection statement 我正在使用带有日食氧气的Oracle 11g,正在尝试建立Jdbc连接,并且正在使用连接语句

Connection con = DriverManager.getConnection("jdbc:oracle:thin:testuser/testuser@localhost");

I am sure that the username and password are right, but still i am getting 我确定用户名和密码正确,但是仍然可以

java.sql.SQLException: ORA-01017: invalid username/password; logon denied

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382)
    at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:573)
    at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:431)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366)
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:752)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:366)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JDBC.main(JDBC.java:12)

Could someone please help? 有人可以帮忙吗?

Maybe you can try using this snippet taken from JAVASE tutorial: 也许您可以尝试使用JAVASE教程中的以下代码段:

Connection conn = null;
Properties connectionProps = new Properties();
connectionProps.put("user", this.userName);
connectionProps.put("password", this.password);

if (this.dbms.equals("mysql")) {
    conn = DriverManager.getConnection(
               "jdbc:" + this.dbms + "://" +
               this.serverName +
               ":" + this.portNumber + "/",
               connectionProps);
} else if (this.dbms.equals("derby")) {
    conn = DriverManager.getConnection(
               "jdbc:" + this.dbms + ":" +
               this.dbName +
               ";create=true",
               connectionProps);
}
System.out.println("Connected to database");
return conn;

EDIT: Or maybe you can try to specify the user and the password like this: 编辑:或者也许您可以尝试指定用户和密码,如下所示:

Connection conn = DriverManager.getConnection("
     jdbc:oracle:thin:@localhost:1521:example", "example","password123");

You have a default case sensitive username and password in the database. 您在数据库中具有默认的区分大小写的用户名和密码。 It is necessary to type the username and password correctly in the case sensitive or change the parameter of the authentication of Oracle sec_case_sensitive_logon=false . 必须区分大小写正确输入用户名和密码,或者更改Oracle sec_case_sensitive_logon=false的认证参数。

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> show parameter sec_case

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
sec_case_sensitive_logon             boolean     TRUE
SQL> alter system set sec_case_sensitive_logon=false scope=both;

System altered.

SQL> show parameter sec_case

NAME                                 TYPE        VALUE
------------------------------------ ----------- -----------------------------
sec_case_sensitive_logon             boolean     FALSE
SQL>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.sql.SQLException:ORA-01017:用户名/密码无效; 登录被拒绝 - java.sql.SQLException: ORA-01017: invalid username/password; logon denied ORA-01017:用户名/密码无效; 使用wss4j时登录被拒绝 - ORA-01017: invalid username/password; logon denied when using wss4j Oracle 11g r2 ORA-01017: 无效的用户名/密码; 通过 JDBC 驱动程序连接时登录被拒绝 - Oracle 11g r2 ORA-01017: invalid username/password; logon denied when connecting via JDBC driver 如何修复&#39;java.sql.SQLException:ORA-01017:无效的用户名/密码; 春季启动时登录被拒绝&#39;错误 - How to fix 'java.sql.SQLException: ORA-01017: invalid username/password; logon denied' error in spring-boot Oracle JDBC:用户名/密码无效 (ora-01017) - Oracle JDBC : invalid username/password (ora-01017) 从TOMCAT迁移到IBM Websphere时,ORA-01017无效的用户名/密码 - ORA-01017 Invalid Username/Password when migrating from TOMCAT to IBM Websphere 带有oracle DB的spring-“ java.sql.SQLException-无效的用户名/密码; 登录被拒绝” - spring with oracle DB - “java.sql.SQLException - invalid username/password; logon denied” 将GWT应用程序连接到Oracle DB会带来“无效的用户名/密码; 登录被拒绝”-登录可以与QuantumDB一起使用吗? - Connect GWT Application to Oracle DB brings 'invalid username/password; logon denied' - Login works with QuantumDB? TomEE ORA-01017服务器尝试通过OS用户进行身份验证 - TomEE ORA-01017 server tries to authenticate with OS user 尝试从 servlet 连接到 Oracle XE 时出现 ORA-01017 错误 - ORA-01017 error when attempting to connect to Oracle XE from servlet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM