Issues with Water and Data Abstract Connection String

Hi

Acctualy, we keep trying to port our project to the new version of Water and Data Abstract. We want to compile and run it on both as Visual Studio 2019 as Elements Water. Follow some issues we have been having:

  1. First of all, after built it, when we start Debug → Run. It show us the first error.

We found some thread saying it was corrected. But seems it wasn`t, or is another kind.

Follow:

  1. If we ignore the 1), we are getting this another one (length cant be less than zero):

A problem similar with this another thread. But we couldn`t figure out.

Follow: Can't connect to Mysql using .net driver with Fire/Silver - #40 by mh

The error occurs at line:

conn := new TDAADOConn(self.connectionManager.AcquireConnection(‘ini’));

Where the connection string is assembled correctly and conn type is represented by IAbstractConnection

After that we get some cascade error that blocks authentication on the server:

On Visual Studio it works well.

Follow a little snippet of the code:

  // conexão db
  str := 'MySql.NET?Server=' + servidor;
  str := str + ';Port=' + porta;
  str := str + ';Database=' + ini.getValor('NomeBanco');
  str := str + ';User ID=' + ini.getValor('Usuario');
  str := str + ';Connect Timeout=300';
  str := str + ';Default Command Timeout=' + timeout;

  if not String.IsNullOrEmpty(maxPoolSize) then begin
    str := str + ';Max Pool Size=' + maxPoolSize;
  end;

  str_i := str;
  str := str + ';Password=' + TBaseConn.mapeiaSenha(ini.getValor('Usuario'),TCrypto.descriptografar(ini.getValor('Senha')),servidor,ini.getValor('NomeBanco'));

  // adiciona definição
  self.connectionManager.AddDefinition('ini',str,true);

  // log
  TLog.add('DB String : ' + str_i);

  // testa conexao database
  ok := false;
  while not ok do begin

    try

      conn := new TDAADOConn(self.connectionManager.AcquireConnection('ini'));
      ok   := true;

    except on E:Exception do begin

      TLog.addError(E,'DB init Error. I will try again. ');

      // tenta novamente 30s
      Thread.Sleep(30000);
    end;
    end;
  end;

Sorry for my english.

Regards.

Hello

Both these exceptions occur during application execution and are handled internally.
First one is raised during a check if the application has been started as a Windows Service and can be avoided if you pass ‘/c’ or ‘–commandline’ as application command line argument.
Not sure why MySQL drivers raise the second exception (this part of code is not related to any of our code), however if the application runs successfully this means that this exception is more or less expected by the driver developers.

You need to adjust your IDE settings to not stop on exceptions that are being caught by application code.