sqlite enable connection pool error
Posted: Fri 13 Dec 2019 16:54
Hello everyone, I just started to learn and use Delphi. When I use the latest UniDAC component (version 8.1.2) to access the SQLite database, as soon as I enable the connection pool, I will get an error: EAssertionFailed 1024 (D:\ProjectsClone1\Delphi\Dac\Common\Source\CRConnectionPool.pas, line 252).
I don’t know what the problem is, and someone can give me some suggestions? Or SQLite database using connection pool code? This is my code:
----------
procedure TForm1.btn1Click(Sender: TObject);
begin
LiteConn := nil;
try
LiteConn := TUniConnection.Create(nil);
try
with LiteConn do
begin
ProviderName := 'SQLite';
Database := 'dasdb.dat';
Pooling := True;
PoolingOptions.Validate := True;
PoolingOptions.MinPoolSize := 1;
PoolingOptions.MaxPoolSize := 50;
PoolingOptions.ConnectionLifetime := 20;
Options.DisconnectedMode := True;
Options.KeepDesignConnected := False;
SpecificOptions.Values['ForceCreateDatabase'] := 'False';
SpecificOptions.Values['ClientLibrary'] := '.\sqlite3.dll';
SpecificOptions.Values['BusyTimeout'] := '10';
Open;
end;
if LiteConn.Connected then
begin
mmo1.Lines.Append('Connected');
LiteConn.Close;
end;
except
on Ex: Exception do
begin
mmo1.Lines.Append(Ex.ClassName + ' ' + Ex.Message);
Exit;
end;
end;
finally
LiteConn.Free;
end;
end;
I don’t know what the problem is, and someone can give me some suggestions? Or SQLite database using connection pool code? This is my code:
----------
procedure TForm1.btn1Click(Sender: TObject);
begin
LiteConn := nil;
try
LiteConn := TUniConnection.Create(nil);
try
with LiteConn do
begin
ProviderName := 'SQLite';
Database := 'dasdb.dat';
Pooling := True;
PoolingOptions.Validate := True;
PoolingOptions.MinPoolSize := 1;
PoolingOptions.MaxPoolSize := 50;
PoolingOptions.ConnectionLifetime := 20;
Options.DisconnectedMode := True;
Options.KeepDesignConnected := False;
SpecificOptions.Values['ForceCreateDatabase'] := 'False';
SpecificOptions.Values['ClientLibrary'] := '.\sqlite3.dll';
SpecificOptions.Values['BusyTimeout'] := '10';
Open;
end;
if LiteConn.Connected then
begin
mmo1.Lines.Append('Connected');
LiteConn.Close;
end;
except
on Ex: Exception do
begin
mmo1.Lines.Append(Ex.ClassName + ' ' + Ex.Message);
Exit;
end;
end;
finally
LiteConn.Free;
end;
end;