Schema Modeler with two Connections

Hello,
on my DA Server I have sucessfully configured 2 connections, used for 2 different DB, Firebird and Oracle databases.
I have imported into the Schema few tables from both sources,
I can see data preview from FB, but on the Oracle tables I get always a DlgError: "Error while executing SQL: not logged on."
I do not understand why, because the TestConnection is successful and I also get from oracle the table list…
The connection string is:
DOA?Server=localhost;Database=//10.236.20.142:1521/xe;UserID=MARCO;Password=passpartout;Pooling=false;

Can you help/suggest ?
Marco

hmm, I can’t reproduce problem when 2 connections exist and DASM is failed

Hi, at the moment I can only show you my screen;
here are the connections

here is my firebird preview, ok

here the oracle table

but when I click the preview tab I get this dlg:

meanwhile I’ll continue to try solve the problem.

if you launch your server, will it work as expected ?
I mean, does this error appear only in Schema modeler, doesn’t it?

not exactly; I try to see these two tables, and after successful login I get an error:

from which seems it is using the Firedac driver to read the oracle table ANAG_DEVICE…
and then I can see the FBird dataset (bottom) only.

The error is the same when I try to get preview data of oracel table at design time

For the FB tables I get the expected data.

Looks like, you doesn’t switch FB connection with Oracle one.
You can

procedure TGeneratorsSample_Service.DataAbstractServiceValidateDatasetAccess(
  Sender: TObject; const aConnection: IDAConnection;
  const aDatasetName: String; const aParamNames: array of String;
  const aParamValues: array of Variant; aSchema: TDASchema;
  var Allowed: Boolean);
var
  i: integer;
  ConName: string;
begin
  ConName := '';

  for i := 0 to aSchema.Datasets.Count - 1 do
    if  AnsiSameText(aSchema.Datasets[i].Name, aDatasetName) then begin
      ConName := aSchema.Datasets[i].Statements[0].Connection;
      break;
    end;

  if  not AnsiSameText(ConName, aConnection.Name) then begin
    Connection := aSchema.ConnectionManager.NewConnection(ConName);

    for i := 0 to aSchema.ConnectionManager.Connections.Count - 1 do
      aSchema.ConnectionManager.Connections[i].Default :=
          AnsiSameText(aSchema.ConnectionManager.Connections[i].Name, ConName);
  end;
end;
var
  conn: TDAConnection;
  lHet: TDAHETConnection;
begin
  conn := ConnectionManager.Connections.Add;
  conn.Name := 'Northwind';
  conn.ConnectionString := Northwind;

  conn := ConnectionManager.Connections.Add;
  conn.Name := 'IBX';
  conn.ConnectionString := Employee_fdb;

  lHet := TDAHETConnection.Create(ConnectionManager.Connections);
  lHet.Name := 'HetConnection';
  lHet.ObjectMappings.Add('CUSTOMER=IBX');  // table_name=connection_name
  lHet.ObjectMappings.Add('Customers=Northwind');
  lHet.Default := True;

I’ll try your suggested steps in code, but why it doesn’t work on SchemaModeler ?
I omitted to try anything in code, because if already DASM cannot show data preview,
the problem shouldn’t be in client side…
In your tests with DASM do you see preview of data on both DB/tables ?

yes, I can see preview for both tables

:frowning: I’ll try to test with other DB…
But when I can see the preview of both DB/tables in DASM
is it still necessary to switch connections at client side ?

DASM has some tweaks for showing data from different connections.
Unfortunately, DAServer can work only with one connection object at once
for working with tables from different databases we have introduced TDAHETConnection feature.

I have changed the Oracle driver to Oracle.NET and now I can see the data preview in both DB !
Probably there is lack in the DOA driver, I guess.

Anyway on Client side I can “Get design-time data” only on a single connection;
I think this confirm what you said about the limit of one connection object only for DAServers.

It is a strange logic for me, because I expect that a Client of a 3-tier framework should be able to deal with published objects (tables) without worry about their original DbConnection…
So I suppose is not possible also create Unions with fields of tables from different connections ?

it should work if you use TDAHETConnection …

Thank you, I’ll try.

1 Like