@Override
 public String getURL(IDatabaseConnection connection) throws DatabaseDialectException {
   if (connection.getAccessType() == DatabaseAccessType.ODBC) {
     return "jdbc:odbc:" + connection.getDatabaseName();
   } else {
     return getNativeJdbcPre()
         + connection.getHostname()
         + ":"
         + connection.getDatabasePort()
         + "/"
         + connection.getDatabaseName();
   }
 }
 @Override
 public String getURL(IDatabaseConnection connection) throws DatabaseDialectException {
   // jdbc:informix-sqli://192.168.149.128:9088/stores:INFORMIXSERVER=demo_on
   if (connection.getAccessType() == DatabaseAccessType.ODBC) {
     return "jdbc:odbc:" + connection.getDatabaseName();
   } else {
     return "jdbc:informix-sqli://"
         + connection.getHostname()
         + ":"
         + connection.getDatabasePort()
         + "/"
         + connection.getDatabaseName()
         + ":INFORMIXSERVER="
         + connection.getInformixServername()
         + ";DELIMIDENT=Y";
   }
 }
  public boolean startup(final IPentahoSession session) {
    try {

      Logger.debug(this, "DatasourceSystemListener: called for startup ..."); // $NON-NLS-1$

      ICacheManager cacheManager = addCacheRegions();

      List<IDatabaseConnection> databaseConnections = getListOfDatabaseConnections(session);

      String dsName = "";
      DataSource ds = null;

      for (IDatabaseConnection databaseConnection : databaseConnections) {

        if (databaseConnection != null) {

          Logger.debug(this, "  Setting up datasource - " + databaseConnection); // $NON-NLS-1$

          // isPortUsedByServer should NOT be called on a JNDI data source
          // http://jira.pentaho.com/browse/BISERVER-12244
          if (!databaseConnection.getAccessType().equals(DatabaseAccessType.JNDI)) {
            // if connection's port used by server there is no sense to get DataSource for this
            ds =
                isPortUsedByServer(databaseConnection)
                    ? null
                    : setupDataSourceForConnection(databaseConnection);
          } else {
            Logger.debug(
                this,
                "(Datasource \""
                    + IDBDatasourceService.JDBC_DATASOURCE // $NON-NLS-1$
                    + dsName
                    + "\" not cached)"); //$NON-NLS-1$
            continue;
          }

          dsName = databaseConnection.getName();

          cacheManager.putInRegionCache(IDBDatasourceService.JDBC_DATASOURCE, dsName, ds);

          Logger.debug(
              this,
              "(Storing datasource under key \""
                  + IDBDatasourceService.JDBC_DATASOURCE // $NON-NLS-1$
                  + dsName
                  + "\")"); //$NON-NLS-1$
        }
      }

      Logger.debug(this, "DatasourceSystemListener: Completed startup."); // $NON-NLS-1$

      return true;

    } catch (ObjectFactoryException objface) {

      Logger.error(
          this,
          Messages.getInstance()
              .getErrorString("DatasourceSystemListener.ERROR_0001_UNABLE_TO_INSTANTIATE_OBJECT"),
          objface); //$NON-NLS-1$

      return false;

    } catch (DatasourceMgmtServiceException dmse) {

      Logger.error(
          this,
          Messages.getInstance()
              .getErrorString("DatasourceSystemListener.ERROR_0002_UNABLE_TO_GET_DATASOURCE"),
          dmse); //$NON-NLS-1$

      return false;
    }
  }