Four Stars

About - tSystem

Hi,
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
connected
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
disconnected
Invalid character constant

Can any body help?
10 REPLIES
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
shong
----------------------------------------------------------
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.
Cheers,
c0utta
One Star

Re: About - tSystem

Hi,
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"
cheers,
cahsohtoa
Employee

Re: About - tSystem

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

Re: About - tSystem

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

Re: About - tSystem

hello
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.io.File;
import java.io.IOException;
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();
//super();
//Connection con=NULL;
try{
Class.forName("com.mysql.jdbc.Driver");

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

String login="root";

String password="123";

conn=DriverManager.getConnection(url,login,password);
String q = "insert into D_KPI (nom_kpi) values(?)";
//String q = "insert into dkpi values(?)";
pst=conn.prepareStatement(q);
// 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){
//System.out.println(j);
//pst.setString(1,j);
System.out.println(kpi);
pst.setString(1,kpi);
//int s = Integer.parseInt(j);
//s=s+1;
//j=(new Integer(s)).toString();

int val = pst.executeUpdate();


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

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

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


}


//Class.forName("com.mysql.jdbc.Driver");
//con=DriverManager.getConnection("jdbc:mysql://localhost/cdm?user=root&password=");
//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
javac Finalimport.java
java Finalimport
Please, how can I do this?
Thanks.
One Star

Re: About - tSystem

hello
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

Hi,
IM trying to use tsystem component to fire this command "cmd /c date | mail -s 'subject' abc@hiki.com".
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.