#1 2007-10-24 10:41:44

rajendhar47
Member
Registered: 2007-10-22
Posts: 17

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.


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

   
Can any body help?

Offline

#2 2007-10-24 11:22:58

shong
Talend team
Registered: 2007-08-29
Posts: 10293
Website

Re: About - tSystem

Hi rajendhar47

You should typed "cmd /c echo Talend is a good tool" and it will run fine.

Best regards

         shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Online

#3 2007-10-24 11:57:40

rajendhar47
Member
Registered: 2007-10-22
Posts: 17

Re: About - tSystem

Thanks, it is working.

Can any body tell me how to call a batch file through tSystem.

Offline

#4 2007-10-25 01:10:07

c0utta
Member
Registered: 2007-04-13
Posts: 134

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

Offline

#5 2008-02-19 10:03:15

cahsohtoa
Member
Company: AEFE
Registered: 2008-02-19
Posts: 261
Website

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

Offline

#6 2008-02-19 15:29:18

mhirt
Talend team
Registered: 2006-09-19
Posts: 1633

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,

Offline

#7 2008-02-19 15:47:48

cahsohtoa
Member
Company: AEFE
Registered: 2008-02-19
Posts: 261
Website

Re: About - tSystem

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

Offline

#8 2010-04-20 11:55:14

meriam
Guest

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.

#9 2010-04-21 10:13:39

meriam
Guest

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.

#10 2010-04-21 19:28:11

emaxt6
Member
Registered: 2008-08-04
Posts: 325

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.

Offline

#11 2010-09-29 11:15:58

karthika
Guest

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.

Board footer

Powered by FluxBB