[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Pedro Gago

11/4/2004 11:45:00 AM

Hi everybody,

I'm making a distributed application in which the data access component
(located in the server) must connect with different databases in the same
server. That means that I will have different ODBCs and I will need to use
one or another depending on the client that access to this data access
component. I have this structure:
Client Machine: client component
Server Machine: server component, data access component (with a config file)
and the two databases

The question is: how can I configure my application in order to work with
both databases? I have thought these solutions:
1) with two config files: it doesn't work because the data access component
would need (with a parameter) the config file to open. I don't want to drag
this parameter from the client component and for all the server components
that are used.
2) with two different entries in the config file: similar to point 1. The
data access component would need a parameter to select the valid entry.
3) duplicate all the components in the server: install the server and the
database access components in two different directories, using each of them
one port (different). If the client knows the port of each server components
and with different config files for the database access component I can
access to different databases.

I hope you understand what I want. If not, please advice me.

Pedro


1 Answer

Ken Kolda

11/4/2004 4:35:00 PM

0

When you say "depending on the client", does that mean the server uses some
logic to determine which database to use for a given client (e.g. IP
address, some login information, etc.) or does the client simply specify
which system it needs data from and the server provides it? Also, do these
two databases provide the same type of information or do they hold different
content? If it's different, then I assume the server would just decide for
itself which system to access based on the data requested. If it's the same,
then you have many choices, e.g.

1) The obvious way, which is pass along with each client call the info
needed to use the correct database. Whether this is efficient or not depends
on how many different functions you'd have to modify to include this
information. In this scenario, I definitely wouldn't have the client pass
the ODBC connection info, just some identifier to say "Database A" or
"Database B". The only reason you'd pass ODBC info is if there's no way for
the server to have advanced knowledge of the possible databases to open.

2) Expose two remoting objects, one for each database. The client choses
which database to access by invoking the appropriate remoting object from
the server.

3) Create a CAO class that wraps the info regarding which database the
client wants to connect to. The client would create an instance of this CAO,
passing in the required connection info. All subsequent data access calls
would go through the CAO, whic would then direct the call to the appropriate
database.

As for how you read the configuration data, that's up to you. Certainly
putting it in a config file with different keys seems to be a reasonable
approach. The client could then use that key to identify which database to
access.

Ken


"Pedro Gago" <pgago_y@yahoo.es> wrote in message
news:%23VX%23IDmwEHA.2172@TK2MSFTNGP14.phx.gbl...
> Hi everybody,
>
> I'm making a distributed application in which the data access component
> (located in the server) must connect with different databases in the same
> server. That means that I will have different ODBCs and I will need to use
> one or another depending on the client that access to this data access
> component. I have this structure:
> Client Machine: client component
> Server Machine: server component, data access component (with a config
file)
> and the two databases
>
> The question is: how can I configure my application in order to work with
> both databases? I have thought these solutions:
> 1) with two config files: it doesn't work because the data access
component
> would need (with a parameter) the config file to open. I don't want to
drag
> this parameter from the client component and for all the server components
> that are used.
> 2) with two different entries in the config file: similar to point 1. The
> data access component would need a parameter to select the valid entry.
> 3) duplicate all the components in the server: install the server and the
> database access components in two different directories, using each of
them
> one port (different). If the client knows the port of each server
components
> and with different config files for the database access component I can
> access to different databases.
>
> I hope you understand what I want. If not, please advice me.
>
> Pedro
>
>