Jump to content
Sign in to follow this  
Jacek Laskowski

[FireDAC] Access to the connection object using Connection Definition Name

Recommended Posts

I use private connection definition configured by Connection Definition Name.

 

FDQuery1.ConnectionName := 'Ora_Demo';
FDQuery1.Open('select * from "Customers"');

But now I need to assigned events on FDConnection level:

 

  Connection.OnRecover := ...;
  Connection.OnRestored := ...;
  Connection.OnLost := ...;

How can I do this when I have only Query and the Connection is automatically created from the connection pool?

 

Edited by Jacek Laskowski

Share this post


Link to post
  • clear FDQuery1.ConnectionName
  • add a TFDConnection 
  • set its ConnectionDefName to your need
  • set FDQuery1.Connection to that connection

Share this post


Link to post
1 hour ago, Jacek Laskowski said:

I search for other, without TFDConnection, I use a FireDAC connection pooling

You are still using connection pooling with this approach. Connection pooling doesn't pool TFDConnection but TPhysConnections which can be accessed by TFDConnection.ConnectionIntf.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×