Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-239

DBCPConnectionProvider should not fail when database username and password are not supplied in hibernate configuration.


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 B1
    • Fix Version/s: 1.0 B2
    • Component/s: Storage
    • Labels:
    • Environment:
      XWiki + Oracle (Externally authenticated)
    • Similar issues:


      In our company, Oracle JDBC connections are externally authenticated (OS authenticated). So, username and password are not passed in when using JDBC drivers. Infact, when you pass them in, the connection fails.

      DBCPConnectionProvider inserts username and password into a hashatbale without checking for null. So, it will get a null pointer exception. Once I added the checks, it worked fine.

      I understand that, external authentication is specific to companies paranoid of security. So, its a very low priority issue.

      public void configure(Properties props) throws HibernateException {
      try {
      log.debug("Configure DBCPConnectionProvider");

      // DBCP properties used to create the BasicDataSource
      Properties dbcpProperties = new Properties();

      // DriverClass & url
      String jdbcDriverClass = props.getProperty(Environment.DRIVER);
      String jdbcUrl = props.getProperty(Environment.URL);
      dbcpProperties.put("driverClassName", jdbcDriverClass);
      dbcpProperties.put("url", jdbcUrl);
      // Username / password
      String username = props.getProperty(Environment.USER);
      String password = props.getProperty(Environment.PASS);
      if(username != null) // Srini - added a null check - does not exist in xwiki source
      dbcpProperties.put("username", username);
      if(password != null) // Srini - added a null check
      dbcpProperties.put("password", password);




            • Assignee:
              vmassol Vincent Massol
              spulugur Srini Pulugurtha
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:
                Date of First Response: