Hello,
I faced the same problem and have found the following solution.
I use TOS 5.1 on Windows 7. For the SSH tunnel to my MySQL server I use plink.exe. You can download this from the
PuTTY Dowload Page
1.) I used tSystem component to start the ssh tunnel and set up a port forwarding from local port 13306 to the remote MySQL server port 3306. The command line looks like
C:\plink.exe user@remote_host_or_ip -pw password -ssh -N -C -L 13306:127.0.0.1:3306
But there is one problem if you use this directly within tSystem component: plink establishes the tunnel but does not return and therefore the talend job does not continue. Add "cmd /c" in front does not help. So we need a little helper script, which will starting plink.exe in the background and then returns so the talend job can continue. I used VBScript for that.
set fs=createobject("wscript.shell")
fs.run "C:\plink.exe user@remote_host_or_ip -pw password -ssh -N -C -L 13306:127.0.0.1:3306", 0
This script is saved as ssh_remote_mysql.vbs
On the tSystem component I used as command
"cscript C:\\ssh_remote_mysql.vbs"
2.) Next I added a tSleep component to my job which gives plink some time (i.e. 3s) to establish the SSH tunnel. Otherwise the first tMysqlInput component runs into an error because the tSystems component starts the VBScript and continues instantly without waiting until the SSH tunnel is established.
3.) Now I'm able to run all my MySQL subjobs. On the MySQL connection settings host must set to 127.0.0.1 and port to 13306
4.) After all MySQL jobs done I added a 2nd tSystem component to delete the SSH tunnel. Therefore I simply kill plink.exe by using the follwing command
"cmd /c taskkill /F /IM plink.exe"
So now every time I run the talend job the SSH tunnel will be established at the beginning and terminated at the end.
I posted this because I did not found a solution somewhere else which is running this way. Hope this helps.