Switching databases

Using .net, I have a data abstract service which generally is using a single database, but there is one particular custom method where I have to connect to a different database completely just to get something I need.

What’s the correct way to do this, as I can’t get it to change to a different connection so that just one datatable can get data from the right place. I just need to tell the local data adapter to point to the right place for different data tables.

Hello

There are several approaches possible. The most simple one is to explicitly specify the required connection when service used in LocalDataAdapter is instantiated:

  var service := new DataService();
  service.ConnectionName := 'QQQ';

  service.Activate(self.SessionID, false);
  try
    var lda := new RemObjects.DataAbstract.LocalDataAdapter(service);

    // .. access data ...
  finally
    service.Deactivate(self.SessionID);
  end;

This might look like somewhat not clean code so I’ll log an issue to provide LDA constructor that will accept the required connection name, so the above will be reduced to

    var lda := new RemObjects.DataAbstract.LocalDataAdapter('DataService', 'Connection Name', self.SessionID);

    // .. access data ...

Expect this change to be available in the next Beta

Thanks, logged as bugs://80686

Thanks Anton, the change make a lot of sense (I looked for something like this, given the delphi version can do something similar with things), so I’ll wait for the next beta for that.

bugs://80686 got closed with status fixed.