connect to multiple DBs on same server

How do I open and talk to two different databased on the same server. I want to read from database 1, insert information from the record found in database 2 if it is not there, then update the record in database1 and read then next record in database 1. I could write a program to open database 1, read all the records, write to database 2, then write a second program to read all the records in database 2, then open database 1 and update all the records. But it would be easier if I could do it all at one.

Larry

It looks like I have to do two “connects” with different names, and “select” each database separately on each connection. Is that right?

I have (at least for now) given up on keeping both DBs open at the same time. When I open the second, it forgets about the first, even if I use different resource names and two connects. I am going to the two program approach, where I get all of the information out of one db, then open the other to insert, and the second program does the opposite for the insert. Pity.

Larry

OK… I did solve the problem with two programs. Program 1 reads all the records I need from database 1 into an array of arrays. It then opens database two and walks through the array (foreach) inserting records into database 2. Program 2 then reads the pertinent information from database 2 into an array of arrays, opens database 1, and updates the records there. Not exactly elegent, but effective!

Larry

Sponsor our Newsletter | Privacy Policy | Terms of Service