[英]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.