Inside the loop where you ask for each table you could set a condition
If the table=x then connectioninfo1
If the table=y then connectioninfo2

JG