简体   繁体   中英

Connect GWT Application to Oracle DB brings 'invalid username/password; logon denied' - Login works with QuantumDB?

I have a GWT Application running local on my Computer via SuperDevMode with integrated Jetty. The Application works fine, but I need to connect to a Oracle DB. I did th following:

    public static Connection getConnection() throws ConfigurationException {
    try {
      if (conn == null) {
        createConnection();
      }
      return conn;
    } catch (SQLException e) {
        System.out.println();
      throw new ConfigurationException(e);
    }
  }

  private static void createConnection() throws ConfigurationException, SQLException {
    try {
      String url = ConfigHelper.getJdbcUrl();
      String user = ConfigHelper.getJdbcUser();
      String password = ConfigHelper.getJdbcPassword();
      String schema = ConfigHelper.getJdbcSchema();
      String driverName = ConfigHelper.getJdbcDriver();
      Driver driver = (Driver) Class.forName(driverName).newInstance();

      DriverManager.registerDriver(driver);
      conn = DriverManager.getConnection(url, user, password);
      conn.setSchema(schema);
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
      throw new ConfigurationException(e);
    }
  }

I try to create the connection; I have a helper class "ConfigHelper" which reads a config file with all the Information. When I start the Application in DebugMode I can see I get the right values from the config file. However I get this Stacktrace:

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

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
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:600)
at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:445)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:380)
at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:760)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at de.axa.schadenreserveOnline.server.db.DBHelper.createConnection(DBHelper.java:51)
at de.axa.schadenreserveOnline.server.db.DBHelper.getConnection(DBHelper.java:32)
... 73 more

The strange thing is, if I use the QuantumDB Plugin for Eclipse to connect to the same Oracle DB with the same data from my config file it works.

Is there anything I missed creating the connection? I apreciate any help Thanks in Advance

Edit: using ojdbc6 11.2.0.3 GWT 2.8.0

You have a default case sensitive username and password in the database. Many applications are automatically converted username and password to uppercase. 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.

test parameter 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

change parameter sec_case_sensitive_logon=false. (you need right dba)

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>

似乎没有任何错误,只是我这边的一个小问题:在我的配置文件中,数据库的密码是正确的,但是它包含一个'\\'-我需要使用'\\'对此进行转义

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM