Connect to multiple databases at one time?

Rob Mostyn mostyn at platformis.net
Wed Jan 19 23:12:45 UTC 2022


Hi Das,

It is as easy as setting up a session and statement object for each DB.

tSessionDB1 & tStatementDB1
tSessionDB2 & tStatementDB2
etc.

Each tSessionDBx does a $logon and creates tStatementDBx accordingly.

In one of my projects I implemented a table class superclass between my db table specific table classes and the super class (tMaster) to assign specific tables to specific session and statement objects in the $construct.
What was easy in this project was that there were no db tables that spanned both databases.

The application code simple did a Do list.$definefromsqlclass(’tx’)
and the session/statement objects were automatically assigned to correct db.  The business logic of the app was oblivious to multiple databases.

Rob Mostyn
mostyn at platformis.net

+44 (0)20 3233 0044

As Carl Sagan once said:
One of the great commandments of science is, "Mistrust arguments from authority." ... Too many such arguments have proved too painfully wrong. Authorities must prove their contentions like everybody else.

> On 19 Jan 2022, at 23:56, Das Goravani <goravanis at gmail.com> wrote:
> 
> 
> 
>> On Jan 19, 2022, at 5:47 PM, Mike Matthews - Omnis via omnisdev-en <omnisdev-en at lists.omnis-dev.com <mailto:omnisdev-en at lists.omnis-dev.com>> wrote:
>> 
>> Hello Das,
>> 
>> We connect several at the same time.  Not really sure how we do it, but we do.
>> 
>> Mike Matthews
> 
> Well that was my understanding, that it could be done, and I imagine you make session objects and statement objects separately for each and log onto each separately.. 
> 
> Someone told me you can only connect one at a time and so I thought I would ask the list.
> 
> Thanks for your input. 
> 
> 
>> 
>> Lineal Software Solutions
>> Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, Devon, EX31 1EU<x-apple-data-detectors://1/1>
>> 
>> omnis at lineal.co.uk<mailto:mike.matthews at lineal.co.uk>
>> 
>> www.lineal.co.uk<http://www.lineal.co.uk/>
>> 
>> www.sqlworks.co.uk<http://www.sqlworks.co/>
>> 
>> On 19 Jan 2022, at 22:38, Das Goravani <goravanis at gmail.com<mailto:goravanis at gmail.com>> wrote:
>> 
>> 
>> Can you connect to multiple SQL databases at one time together?
>> 
>> Or only one at a time, and you switch back and forth to do multiple?
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com <http://lists.omnis-dev.com/>
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com <mailto:omnisdev-en at lists.omnis-dev.com>


More information about the omnisdev-en mailing list