title: DBX Error: Driver could not be properly initialized when use OmniThreadLibrary (but ok otherwise)
body: <p>I need to make a long running task in the background. I'm using <a href="http://otl.17slon.com/" rel="nofollow">OmniThreadLibrary</a> hopping this could help me.</p>
  
  <p>I use dbexpress+mssql driver. I can connect ok when is in the main thread, but get:</p>
  
  <blockquote>
    <p>Project Project1.exe raised exception class TDBXError with message
    'DBX Error:  Driver could not be properly initialized.  Client library
    may be missing, not installed properly, of the wrong version, or the
    driver may be missing from the system path.'.</p>
  </blockquote>
  
  <p>The connections are created in each thread, not shared datamodule:</p>
  
  <pre><code>type
    TdbManager = class(TObject)
    private
      { private declarations }
      FCon: TSQLConnection;
    public
      { public declarations }
      procedure Open(Driver:String; aparams:TStringList);overload;
      procedure Close;
  
      constructor Create;
      destructor Destroy;override;
    end;
  
    constructor TdbManager.Create;
  begin
    inherited Create;
    FCon := TSQLConnection.Create(nil);
  end;
  
  procedure TdbManager.Open(Driver: String; aparams: TStringList);
  var
    i: Integer;
    key:string;
  begin
    FCon.DriverName := Driver;
  
    for i := 0 to params.Count - 1 do
    begin
      key := params.Names[i];
      FCon.Params.Values[key] := params.Values[key];
    end;
  
    LogMsg('Open DB '+ Driver + ': ' + FHost + '\' + FDatabase);
  
    FCon.Open;
    LogMsg('Done.');
  end;
  </code></pre>
  
  <p>And the background task is executed:</p>
  
  <pre><code>procedure TBackupPlan.OnScheduleTrigger(Sender: TScheduledEvent);
  begin
    Parallel.Async(procedure
    begin
      ExecuteDataTask( Sender.Name );
    end);
  end;
  
  procedure TBackupPlan.ExecuteDataTask(const Name: String);
  var
    db:TdbManager;
  begin
    db := nil;
  
    db := TSqlServerManager.Create;
    db.Open(self.Driver, options);
  
    result := db;
  end;
  </code></pre>
  
  <p>If I execute this directly, open ok. If I use <code>Parallel.Async</code> then get the error. What is happend here?</p>