• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Dynamic database connection

#1 2009-02-25 12:01:04

snawab2001
New member
Registered: 2009-02-20
Posts: 7

Dynamic database connection

I have 10 databases with a common table "district"......I want to merge district table of all the databases.......
how i can achieve my target with dynamic database connection and  a loop

for ex

dbcon1 Database 1  district dable
dbcon2 Database 2  district dable
dbcon3 Database 3  district dable
dbcon4 Database 4  district dable
dbcon5 Database 5  district dable

for i =1 to 5
     set dbcon= dbcon$i
loop

thanks in advance

Offline

#2 2009-02-25 19:14:34

rbaldwin
Member
Registered: 2008-11-24
Posts: 126

Re: Dynamic database connection

Hi,
You can dynamically set up database connections by using a tForeach and supplying the database name in the foreach values.  If you choose this method, you can then use the iterate link and have the database name set by String.valueOf(globalMap.get("tForeach_1_CURRENT_VALUE")).  Additionally, you can also use the tLoop component.  Set it as a for loop and provide the start and end value as well as the number by which to increment the counter.  From here, you will use the iterate link and set the database name to be, from your example, "dbcon"+globalMap.get("tLoop_1_CURRENT_VALUE").  Attached are images from an example job I've put together to demonstrate this capability.

Regards,


Uploaded Images

Last edited by rbaldwin (2009-02-25 19:34:16)

Offline

#3 2009-02-26 08:25:30

snawab2001
New member
Registered: 2009-02-20
Posts: 7

Re: Dynamic database connection

Thanks....Working fine

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » Dynamic database connection

Board footer

Powered by FluxBB