I am planning to design an application which would fetch data from a common database located in different servers.
Ex:
- Database A in Server SQLSRV001
- Database A in Server SQLSRV002
- etc
I have a sql select query which is to be executed in Database A located in different servers.
select * from Database A where column1='' and column2=''
I wanted to know if it is possible to create a dynamic connection object such that it uses the same select query and takes the several server number as user (or a hard-coded) input. It executes the select query in the database and brings back the result. Then takes the next server number in line as input, fetches the data, etc.. This goes on until all the server numbers are done with.
Any insight on this would be gladly accepted.
yes you can do that indeed…
Create a new class and make it an object of type SQLConnection or w/e it is.
It’s purpose should be to create and maintain a connection with a database and perform various tasks (this part is optional, as you can directly pass in the queries).
Got this from online
So when you have different databases you can go like:
So now you have 2 concurrent connections to 2 different databases