PDA

View Full Version : several-databases-Vs-DbExplor



Edgar H. Peņa C.
12-Aug-2021, 04:55 AM
Hi all


https://support.dataaccess.com/Forums/showthread.php?67592-several-databases-Vs-DbExplor

Edgar

Samuel Pizarro
12-Aug-2021, 06:49 AM
Vincent have answered you. Have you even tried doing it?

if yes, give more details of what have you done and what errors are you facing.

Are you using managed connections or nor?

Edgar H. Peņa C.
13-Aug-2021, 05:13 AM
Samuel/Vincent,

In my application I have a directory of Tenants (01, .. nn) that can use an independent DB or be in a DB with many other tenants (01001, .... 01nnn). In turn, a tenant provides accounting services to his clients. The current scenario is that our application is for accounting services, where an accountant (tenant) keeps several accounts for his clients (sub-tenants). When accessing a tenant (meter) it is identified so that the program looks for the corresponding DB (sDatabaseName) and thus builds the connection string, so that the meter will see its clients (sub-tenants) in a directory. In summary, there will be several DBs in the same workspace. Then I would have to create as many ID CONECTIONS as BD has in the worksapace. So far the model has worked well. I was thinking of something more autonomous on the part of dbexplor that when selecting the workspace it could write the DB to load. I hope I have explained myself sufficiently, without causing discomfort Thanks




If (gsDefaultBD<>"") Begin
Get ConnectionIDs of ghoConnection to ConnIDs
If (SizeOfArray(ConnIDs)>0) Begin
Get ConnectionIdInfo of ghoConnection "MF40xxxxxxxD" to sConInfo
If (sConInfo.iDriverIndex) Begin
Get ConnectionDatabaseIdHandle of ghoConnection sConInfo to hConnectionHandle
If (hConnectionHandle) Begin
Get_Attribute DF_DATABASE_DEFAULT_DATABASE of sConInfo.iDriverIndex hConnectionHandle to sDatabaseName
If (gsDefaultBD<>sDatabaseName) Begin
Set_Attribute DF_DATABASE_DEFAULT_DATABASE of sConInfo.iDriverIndex hConnectionHandle to gsDefaultBD
End
End
End
End



Edgar

Samuel Pizarro
13-Aug-2021, 06:42 AM
Then I would have to create as many ID CONECTIONS as BD has in the worksapace

yes. That is how it works.

As far as I know, there is no other “easier” way.

About your “more autonomous “ way, how do you expect db explorer to pickup the desired db, if there are many? That’s why the managed connections were designed. You can register all of them you need and switch ( making the desired the active one)

Edgar H. Peņa C.
13-Aug-2021, 07:58 AM
thanks Samuel