0

The goal is to migrate data from one mysql database to another, my concern is to define a text file that contains the parameters that defines the source database (host, port, databasename, etc.) and also the file parameters of the output database.

Actually, what I use is the following schema:

tContextLoad_1 -> tFileInputDelimited_1-> tMysqlInput_1 (db_source) -> tMap->
tMysqlInput_2 (db_destination)

depending on the problem that has occurred is:

1- The tContextLoad_1 text file content change is not supported and the pointing is always on the first database "source database".

2- When I create a second tContextLoad_2 can not be connected by a (but) or (trigger-On subject Ok) with tFileOutputDelimited_1 that linked with tMysqlInput_2 (db_destination), how to define a file that contains the definition parameters of a base output data (host, databasename, identifier, password, etc.) ?

Ahmad
  • 5,551
  • 8
  • 41
  • 57
tchiko
  • 56
  • 6

2 Answers2

0

You can use a configuration file like following,

<connections>
  <connection>
    <host></host>
    <port></port>
    <database></database>
    <table></table> 
    <user></user>
    </password></password>
  </connection>

  <connection>
    <host></host>
    <port></port>
    <database></database>
    <table></table> 
    <user></user>
    </password></password>
  </connection>
</connections>

And then you can iterate on connection tag to fetch the DB details and then assign them to variables and use it.

So the flow would be like, tFileInputXML-->SetGlobalVar-->tMySQLConnection-->tMySQLInput-->tMap-->tMySQLOutput

Vish
  • 186
  • 3
  • 17
0

You can either define a single file, but with different parameter names for the source connection and target connection, or define 2 files : one for the source and one for the target, in that case your parameters can have the same name :

  1. Single context file with different parameter names:

tFileInputDelimited_1 (context file) -- tContextLoad_1 | OnSubjobOk | Source(host1,db1,user1,pwd1) -- target(host2,db2,user2,pwd2)

  1. Different context files having the same parameter names:

tFileInputDelimited_1 (1st context file) -- tContextLoad_1 | OnSubjobOk | Source(host,db,user,pwd) -- temp_file | OnSubjobOk | tFileInputDelimited_2 (2nd context file) -- tContextLoad_2 | OnSubjobOk | temp_file -- target(host,db,user,pwd)

I'm sure you'll agree with me that the 1st solution is simpler, and more efficient.

Your context files could be like this : key=value

host=myHost
db=myDB
user=myUser
Ibrahim Mezouar
  • 3,981
  • 1
  • 18
  • 22