Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating multiple databases

Status
Not open for further replies.

zeero

Programmer
Aug 4, 2004
60
US
Is there a way to update multiple databases on multiple servers at once? e.g. I have identical databases on a few different servers and I made a form in jsp where I select the servers with checkboxes, then enter the info to insert, then submit. I've tested it out and it updates successfully, but when I select multiple servers, it just updates whatever server is first on the list. Would this be my syntax in how I went about selecting the servers in the code or is there something special I need to do to connect to them all at once? Thanks.
 
Would it not be easier to update just one server, and then use database replication to update the others as a batch job (see your DBA's).

--------------------------------------------------
Free Database Connection Pooling Software
 
They are not set up to do that because only certain tables are replicates.
 
You do realise that performing SQL transactions against several databases will slow you webapp down a lot, and make it more unstable. What happens if you update db's A & B, but on C your SQL fails ? Are you going to roll back all the transactions on the other servers ? You need to be very careful.

Anyway, if you are using connection pooling, then you need to set up several pools for each db server.
If you are not using pooling (for several databases I would suggest you do), then you need to just get a Connection from the DriverManager for each server.

Once you have your connection objects, you need to perform the SQL each time on each database. I would suggest rolling back all transactions if any of them fail, else you will have concurrency problems.

--------------------------------------------------
Free Database Connection Pooling Software
 
Hi,

I agree with sedj about the batch job. If you are using Oracle you can use linked servers and call a single stored procedure which updates the data in all the servers.


Cheers
Venu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top