FireDAC + EntityDAC + DataSnap
-
- Posts: 48
- Joined: Mon 30 Apr 2007 07:36
FireDAC + EntityDAC + DataSnap
Hi,
How I can configure TEntityConnection to use a pooled connection (SQLServer 2014) with FireDAC + EntityDAC in a Datasnap REST application?
Thank you very much
Best Regads
Claudio
How I can configure TEntityConnection to use a pooled connection (SQLServer 2014) with FireDAC + EntityDAC in a Datasnap REST application?
Thank you very much
Best Regads
Claudio
Re: FireDAC + EntityDAC + DataSnap
Hello,
If FireDAC supports such functionality, and these parameters can be set in ConnectionString, you can set a corresponding ConnectionString for dEntityConnection
If FireDAC supports such functionality, and these parameters can be set in ConnectionString, you can set a corresponding ConnectionString for dEntityConnection
-
- Posts: 48
- Joined: Mon 30 Apr 2007 07:36
Re: FireDAC + EntityDAC + DataSnap
Hi Alex
thank you very much for your answer. The problem is that FireDAC allows pooled connection only in Persistent and Private connections definition.
In FDConnection I must use the ConnectionDefName property and not ConnectionString, but I cannot associate ConnectionDefName to a connectionstring property in TEntityConnection.
Here the FireDAC sample:
var
oParams: TStrings;
begin
oParams := TStringList.Create;
oParams.Add('Database=ORA_920_APP');
oParams.Add('User_Name=ADDemo');
oParams.Add('Password=a');
oParams.Add('Pooled=True');
FDManager.AddConnectionDef('Oracle_Pooled', 'Ora', oParams);
.....................
FDConnection1.ConnectionDefName := 'Oracle_Pooled';
FDConnection1.Connected := True;
thank you very much for your answer. The problem is that FireDAC allows pooled connection only in Persistent and Private connections definition.
In FDConnection I must use the ConnectionDefName property and not ConnectionString, but I cannot associate ConnectionDefName to a connectionstring property in TEntityConnection.
Here the FireDAC sample:
var
oParams: TStrings;
begin
oParams := TStringList.Create;
oParams.Add('Database=ORA_920_APP');
oParams.Add('User_Name=ADDemo');
oParams.Add('Password=a');
oParams.Add('Pooled=True');
FDManager.AddConnectionDef('Oracle_Pooled', 'Ora', oParams);
.....................
FDConnection1.ConnectionDefName := 'Oracle_Pooled';
FDConnection1.Connected := True;
-
- Posts: 48
- Joined: Mon 30 Apr 2007 07:36
Re: FireDAC + EntityDAC + DataSnap
Hi Alex,
sorry, you are right! Problem solved! I can set this in ConnectionString of the TEntityConnection component.
Best regards and thank you very much
sorry, you are right! Problem solved! I can set this in ConnectionString of the TEntityConnection component.
Best regards and thank you very much
Re: FireDAC + EntityDAC + DataSnap
Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.
Re: FireDAC + EntityDAC + DataSnap
Hi there,
I am working with EntityDAC+FireDAC+MySQL and I have a problem with the parameter Pooled in TEntityConnection.ConnectionString. If I set this parameter to False, everything is fine, but if I set it to True, then I get a FireDAC error something like "the connection is not in FDManager.ConnectionDefs-list or TFDConnection.Params has additional parameters".
Then, I looked into the unit EntityDAC.DataProvider.FireDAC
I put the following code into the method TFireDACConnectionProvider.DoConnect
With this code EntityDAC can do the FireDAC connection pooling. But the disadvantage I have to hack the EntityDAC-Units. Is there any possibility to get the funtionality without this hack?
Thank you!
I am working with EntityDAC+FireDAC+MySQL and I have a problem with the parameter Pooled in TEntityConnection.ConnectionString. If I set this parameter to False, everything is fine, but if I set it to True, then I get a FireDAC error something like "the connection is not in FDManager.ConnectionDefs-list or TFDConnection.Params has additional parameters".
Then, I looked into the unit EntityDAC.DataProvider.FireDAC
I put the following code into the method TFireDACConnectionProvider.DoConnect
Code: Select all
procedure TFireDACConnectionProvider.DoConnect;
var
ConDef: IFDStanConnectionDef;
begin
inherited;
if FDManager.ConnectionDefs.FindDefinition('MyConnectionName') = nil then
begin
ConDef := FDManager.ConnectionDefs.AddConnectionDef;
ConDef.Name := 'MyConnectionName';
ConDef.Params.Pooled := True;
ConDef.Params.PoolMaximumItems := 500;
ConDef.Params.Database := 'mydatabase';
ConDef.Params.UserName := 'myUserName';
ConDef.Params.Password := 'MyPassoword';
ConDef.Params.Add('Port=3306');
ConDef.Params.Add('Server=localhost');
ConDef.Params.DriverID := 'MySQL';
ConDef.MarkPersistent;
ConDef.Apply;
end;
FFDConnection.ConnectionDefName := 'MyConnectionName';
FFDConnection.Open;
end;
Thank you!
Re: FireDAC + EntityDAC + DataSnap
Thank you for the information. We have reproduced the issue when using pooling and will try to fix this behavior shortly.
Re: FireDAC + EntityDAC + DataSnap
You are welcome, it would be great to get an update shortly! I need actually this code already yesterday
Re: FireDAC + EntityDAC + DataSnap
Hello Alex,
how do you think, how much time would devart need to fix this problem? Thank you!
Best regards,
pst
how do you think, how much time would devart need to fix this problem? Thank you!
Best regards,
pst
Re: FireDAC + EntityDAC + DataSnap
We have added a ConnectionDefName parameter for FireDAC. Now, to use Pooled or other additional connection parameters, you should create ConnectionDefs with corresponding parameters (in the code or using FireDAC Explorer), and specify the connection name as follows:
where MySQLTest is the name of the created connection.
Code: Select all
EntityConnection1.ConnectionString := 'Data Provider=FireDAC;SQL Dialect=MySQL;Login Prompt=False;ConnectionDefName=MySQLTest'
Re: FireDAC + EntityDAC + DataSnap
Great! Where can I get this update?
Re: FireDAC + EntityDAC + DataSnap
We can send you a night build in order for you to check this case on your sample. For this, please send your license number to support*devart*com .
Re: FireDAC + EntityDAC + DataSnap
Our IT service company will send you a request to get the last night build. Thank you very much!
Re: FireDAC + EntityDAC + DataSnap
send by mail
Re: FireDAC + EntityDAC + DataSnap
Hi Alex,
thx for the email. My test failed
I used the folowing code in my main application:
In the provider the commented commands are empty
Thx for your help!
thx for the email. My test failed
Code: Select all
EMySQLNativeException: [FireDAC][Phys][MySQL] Access denied for user 'ODBC'@'localhost' (using password: NO)
Code: Select all
FDManager.ConnectionDefFileAutoLoad := False;
if FDManager.ConnectionDefs.FindDefinition('MyConnectionName') = nil then
begin
ConDef := FDManager.ConnectionDefs.AddConnectionDef;
ConDef.Name := 'MyConnectionName';
ConDef.Params.Pooled := True;
ConDef.Params.PoolMaximumItems := 500;
ConDef.Params.Database := 'mydatabase';
ConDef.Params.UserName := 'myUserName';
ConDef.Params.Password := 'MyPassoword';
ConDef.Params.Add('Port=3306');
ConDef.Params.Add('Server=localhost');
ConDef.Params.DriverID := 'MySQL';
ConDef.MarkPersistent;
ConDef.Apply;
end;
EntityConnection1.ConnectionString := 'Data Provider=FireDAC;SQL Dialect=MySQL;Login Prompt=False;ConnectionDefName=MyConnectionName'
Code: Select all
procedure TFireDACConnectionProvider.DoConnect;
begin
inherited;
// FFDConnection.ConnectionDefName --> empty
// FFDConnection.Params.UserName --> empty
// ...
FFDConnection.Open;
end;