@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";
   }
 }
  @VisibleForTesting
  protected boolean isPortUsedByServer(IDatabaseConnection databaseConnection) {
    // get connection IP address
    String connectionHostName = databaseConnection.getHostname();
    InetAddress connectionAddress = null;
    try {
      connectionAddress = getAdressFromString(connectionHostName);
    } catch (UnknownHostException e) {
      Logger.warn(
          this,
          Messages.getInstance()
              .getErrorString(
                  "DatasourceSystemListener.WARN_0001_UNABLE_TO_GET_CONNECTION_ADDRESS"),
          e); //$NON-NLS-1$
      return false;
    }
    // get connection port
    String stringConnectionPort = databaseConnection.getDatabasePort();

    // get server URL
    String fullyQualifiedServerURL =
        PentahoSystem.getApplicationContext().getFullyQualifiedServerURL();
    URL url = null;
    try {
      url = new URL(fullyQualifiedServerURL);
    } catch (MalformedURLException e) {
      Logger.warn(
          this,
          Messages.getInstance()
              .getErrorString("DatasourceSystemListener.WARN_0002_UNABLE_TO_PARSE_SERVER_URL"),
          e); //$NON-NLS-1$
      return false;
    }
    // get server IP address
    String hostNameUsedByServer = url.getHost();
    InetAddress serverAddress = null;
    try {
      serverAddress = getAdressFromString(hostNameUsedByServer);
    } catch (UnknownHostException e) {
      Logger.warn(
          this,
          Messages.getInstance()
              .getErrorString("DatasourceSystemListener.WARN_0003_UNABLE_TO_GET_SERVER_ADDRESS"),
          e); //$NON-NLS-1$
      return false;
    }
    // get server port
    int portUsedByServer = url.getPort();

    boolean isAddressesEquals = connectionAddress.equals(serverAddress);

    boolean isPortsEquals = false;
    try {
      Integer connectionPort = Integer.valueOf(stringConnectionPort);
      isPortsEquals = connectionPort.equals(portUsedByServer);
    } catch (NumberFormatException e) {
      Logger.warn(
          this,
          Messages.getInstance()
              .getErrorString("DatasourceSystemListener.WARN_0004_UNABLE_TO_GET_PORT_NUMBER"),
          e); //$NON-NLS-1$
      return false;
    }

    return isAddressesEquals && isPortsEquals;
  }