[wish]: Multiple databaseinstance support in Fastreport

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
waeberd
Posts: 22
Joined: Tue 09 Nov 2004 06:48

[wish]: Multiple databaseinstance support in Fastreport

Post by waeberd » Mon 15 Jan 2007 08:00

Hi,

thanks a lot for providing the FastReport-connection classes for using ODAC-functionality.

I discovered one problem:

if using the FastReport Server (for web-access), it is only possible to connect to the DEFAULTDATABASE, which is one of the created TOraSession instances:

Code: Select all

{ TfrxDatabaseProperty }

function TfrxDatabaseProperty.GetValue: String;
var
  db: TfrxODACDatabase;
begin
  db := TfrxODACDatabase(GetOrdValue);
  if db = nil then
  begin
    if (ODACComponents  nil) and (ODACComponents.DefaultDatabase  nil) then
      Result := ODACComponents.DefaultDatabase.Name
    else
      Result := frxResources.Get('prNotAssigned');
  end
  else
    Result := inherited GetValue;
end;
I would like to be able to switch between several databases in the Fastreport editor. Same issue occurs with the mySQL packages (only one of the mySQL (TMyConnection) instances is visible in the fastreport editor.

How about improving this? Or any hint of how I could do this myself (I will try to read the TOraQuery connection handling code).

Thanks again & would be great to get news about this!

Best regards, Daniel

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 16 Jan 2007 15:16

Please describe more detailed the situation when you can't use several connections or provide a complete small test project.
We used recommended templates when supporting Fast Report.
Try to use the TfrxODACDatabase component and do not assign any value to FrxODACCompnents.DefaultDatabase.

waeberd
Posts: 22
Joined: Tue 09 Nov 2004 06:48

Post by waeberd » Wed 17 Jan 2007 11:51

Evgeniy,

Please have a look at my project here:
http://213.180.191.114/download/dw_rve/FRServer.zip

In fact I am using the FastReport Server demo that comes with the FR distribution (located in the "\demos\clientserver\server" folder).

In the main form I have added one TOraSession and one TMyConnection object (and dropped the ADO stuff which will make most of the demo reports unusuable, but this is ok).

If you run the demo, a web-server running fastreport is started and you can edit the reports using the "Designer" button of the server dialog (use the tray icon to launch it).

Now, in the designer I am able to add TfrxOraQuery and TfrxMyDACQuery components to a report. All great!

Now I would like to have more than one oracle and/or more than one mysql connections available in the report designer. I've tried this by adding another TOraSession / TMyConnection object to the server main form.

This doesn't work. In the designer I can only link queries to exactly one TMyConnection and exactly one TOraSession. Additional sessions are not available in the reporting engine.

The only workaround I see is to add all the used connection objects in the report definition itself, but this is not very elegant (and not recommended by FastReport for performance / security reasons).

So it would be fantastic if there was a way to set the DATABASE property of the TfrxMYDACQuery / TfrxODACQuery, or another way to choose the session!

I hope this post makes it clearer, otherwise please ask and I will add some screenshots.

Thanks for your time & best regards,

Daniel

waeberd
Posts: 22
Joined: Tue 09 Nov 2004 06:48

Post by waeberd » Wed 17 Jan 2007 12:02

or in short:

Please take the FastReport Client Server demo:
1) kick out the ado stuff in the main form
2) add TWO TOraSessions
3) add one TfrxODACComponent

4)Launch the project and enter the designer:
5) Click the DATA-Tab
6) Add a TfrxODACQuery to the report
7) try to change the "Database"-property in the object-inspector
=> not changeable, only one of the TOraSessions added in step (2) is visible

Hope that helps and hope you can help me! :o

Thanks, Daniel

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Thu 18 Jan 2007 12:36

The Fast Report architecture doesn't allow to add such functionality smoothly.
Current behaviour is recommended by Fast Report, and is compatible with other similar components (BDE, ADO etc.).
Try the following way:
in the Fast Report designer on the Data sheet add the TfrxODACDatabase component and configure it as you need. Then you can select this component in the Database property editor of TfrxODACQuery. If you want to return to the default connection, just clear the Database property of the TfrxODACQuery component.

waeberd
Posts: 22
Joined: Tue 09 Nov 2004 06:48

Post by waeberd » Thu 18 Jan 2007 19:41

ok, I will check out your suggestion. Maybe the "template reports" feature of FastReport4 can be helpful too.

Thanks for your help!

Daniel

Post Reply