Four Stars

About - tSystem

I am trying to execute command using "tSystem" component.I am using only one componet. In properties I have typed "echo Talend is a good tool". When I execute this, I am getting following error.

connecting to socket on port 4068
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid character constant

Can any body help?
Community Manager

Re: About - tSystem

Hi rajendhar47
You should typed "cmd /c echo Talend is a good tool" and it will run fine.
Best regards
Talend | Data Agility for Modern Business
Four Stars

Re: About - tSystem

Thanks, it is working.
Can any body tell me how to call a batch file through tSystem.
One Star

Re: About - tSystem

Hi rajendhar47,
You call it the same way that shong has specified, "cmd /c batchfile.bat". "cmd /c" runs the command shell of the OS, runs batchfile.bat, and then terminates.
It might help to spawn a command shell and type "cmd /?" to see a full list of the syntax. One thing that may trip you up is the relative location of where the batchfile will be executed - I always put a "cd\" (change directory) as the first statement in my batch files.
One Star

Re: About - tSystem

I'm trying to use the Tsystem component on a windows system to read a key in the key registery. In my windows console I don't have any problem but talend return to me
Error unvalide keyname
My shell script is
"cmd /c reg query \"hkcu/software/PDFCreator/Program\" /v AutosaveFilename"

Re: About - tSystem

REG QUERY doesn't accept /
"cmd /c reg query \"hkcu/software/PDFCreator/Program\" /v AutosaveFilename"
"cmd /c reg query hkcu\\software\\PDFCreator\\Program /v AutosaveFilename"
One Star

Re: About - tSystem

It works!!!
thank you very much for your help
One Star

Re: About - tSystem

I want to use a job with these component: File.xls >>>>tsystem>>>tuniqrow>>>>OutDB.
I wrote a java code which enable me to extract cells from excelfile and put it in a tablemysql.
This is the code:
import jxl.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

//import jxl.Cell;
//import jxl.Sheet;
//import jxl.Workbook;
import jxl.READ.biff.*;
//import jxl.READ.biff.BiffException;

public class Finalimport {

public static Connection conn=NULL;
PreparedStatement pst=NULL;

public Finalimport() throws BiffException, IOException{
Workbook WbFichier= Workbook.getWorkbook(new File("C:\\Documents and Settings\\mariem.essaies.stg\\Bureau\\DAILY REPORT\\7_sgsn subs.xls"));
//ouverture de la 1ère feuille
Sheet shtFeuille = WbFichier.getSheet(0);

int nmax = shtFeuille.getColumns();
//Connection con=NULL;

String url="jdbc:mysql://localhost/datamartgprs";

String login="root";

String password="123";

String q = "insert into D_KPI (nom_kpi) values(?)";
//String q = "insert into dkpi values(?)";
// String j="1";
FOR( int i=3; i<nmax; i++) {

//Recuperation de la valeur d'une cellule
Cell cel01 = shtFeuille.getCell(i,3);
//Cell cel01 = shtFeuille.getCell("D4");
String kpi = cel01.getContents();
//Cell cel02 = shtFeuille.getCell("B1");

//if (cel01.getType()== CellType.DATE){
//int s = Integer.parseInt(j);
//j=(new Integer(s)).toString();

int val = pst.executeUpdate();

//j=(new Integer(s)).toString();

// System.out.println("Connexion etablie");
catch (Exception e){

System.out.println("Connexion échouée!!!");


//String q = "insert into masterdata values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

// TODO Auto-generated constructor stub
//ouverture du fichier

public static void main(String[] args)throws BiffException, IOException {
// TODO Auto-generated method stub
Finalimport impo= new Finalimport();


* @param args
* @throws IOException
* @throws BiffException

How can I change this code if I want to make it work on Talend with every component in entry and every table outmysql.
I should wrote this in my tsysyem :
cd C:\Program Files\Java\jdk1.6.0_10\bin
java Finalimport
Please, how can I do this?
One Star

Re: About - tSystem

to simplify what i have written before, I tried to put 3 component tsystem with a tlogRow:
tsystem ("cmd /c")>>>>tsystem("cd C:\\Program Files\\Java\\jdk1.6.0_10\\bin")>>>tsystem ("java Finalimport") >>tLogRow
I have always this error message that show me cd is not reconized as a command .
How can I write these 3 command on only one tsystem component? Please, help me to resolve this problem. Thanks.
Six Stars

Re: About - tSystem

Apart of your error, honestly with such custom coding you are quite invalidating the reason to use an ETL tool like Talend that has the ability to seamlessly import and process excel files...
that said, "cd" is not a command in windows, but a builtin function of the command processor cmd.exe... you can't invoke it directly.
Also "cmd /c cd" isn't going to work because the "current dir" doesn't persist between shell calls...
Just write a .bat or .cmd script file with the commands you want and use just one tsystem to invoke such script.
One Star

Re: About - tSystem

IM trying to use tsystem component to fire this command "cmd /c date | mail -s 'subject'".
It throw's error "mail is not recognized as a command".I'm unable to use tsendmail component since smtp host and port is not enabled.Kindly help me with how can i use the mail command in tsystem or anyother way to send mail.