Uploaded image for project: 'OpenICF'
  1. OpenICF
  2. OPENICF-344

jndiProperties are not usable without using a datasource

    XMLWordPrintable

Details

    Description

      When using jdbcUrlTemplate to connect to a database, any jndiProperties that are set are not used. This means it is impossible to require encryption with Oracle without using a datasource. See in the code below how "prop" is not used when connecting without datasource :

      private static Connection connect(ScriptedSQLConfiguration config) {
      Connection connection;
      final String login = config.getUser();
      final GuardedString password = config.getPassword();

      final String datasource = config.getDatasource();
      if (StringUtil.isNotBlank(datasource)) {
      log.info("Get a new connection using datasource

      {0}", datasource);
      final String[] jndiProperties = config.getJndiProperties();
      final ConnectorMessages connectorMessages = config.getConnectorMessages();
      final Hashtable<String, String> prop = JNDIUtil.arrayToHashtable(jndiProperties, connectorMessages);
      if (StringUtil.isNotBlank(login) && password != null) { connection = SQLUtil.getDatasourceConnection(datasource, login, password, prop); } else { connection = SQLUtil.getDatasourceConnection(datasource, prop); }
      log.ok("The new connection using datasource {0}

      is created", datasource);
      } else {
      final String driver = config.getJdbcDriver();
      final String connectionUrl = config.formatUrlTemplate();
      log.info("Getting a new connection using connection url

      {0} and user {1}", connectionUrl, login);
      connection = SQLUtil.getDriverMangerConnection(driver, connectionUrl, login, password);
      log.ok("The new connection using connection url {0}

      and user

      {1}

      is created", connectionUrl, login);
      }

      Attachments

        Activity

          People

            laszlo Laszlo Hordos (Inactive)
            vrioux Vincent Rioux [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: