Import .sql file in mysql data base using talend

One Star

Import .sql file in mysql data base using talend

Hello everyone,
i have imported .csv file and Excel file in mysql database using talend. but i am not getting how to import .sql file which is exported by other relational database.

Thank you.
Seventeen Stars

Re: Import .sql file in mysql data base using talend

hi,
have a look at that post :
http://www.talendforge.org/forum/viewtopic.php?id=28285
regards
laurent
One Star

Re: Import .sql file in mysql data base using talend

thank you laurent .
i am trying
mysql db_name < my path of file.sql> output.tab

but here i am not getting what is mean of output.tab ? is it output database table name?

Regards
snehal
Seventeen Stars

Re: Import .sql file in mysql data base using talend

hi
have a look at mysql specification to execute SQL statement from command line :
http://dev.mysql.com/doc/refman/5.6/en/mysql.html
regards
laurent
One Star

Re: Import .sql file in mysql data base using talend

Hi,
i am using windows machine, and when i am writing command in tSystem it is giving following Error:
"mysql test <D:/Gems Data/data/localhost.sql> output.tab"

Starting job sqlfile at 12:19 03/09/2013.
Exception in component tSystem_1
java.io.IOException: Cannot run program "mysql": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at demo.sqlfile_0_1.sqlfile.tSystem_1Process(sqlfile.java:277)
at demo.sqlfile_0_1.sqlfile.runJobInTOS(sqlfile.java:550)
at demo.sqlfile_0_1.sqlfile.main(sqlfile.java:416)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 7 more
connecting to socket on port 3556
connected
disconnected
Job sqlfile ended at 12:19 03/09/2013.

Where test is my data base name.

can you please tell where i am going wrong.

Regards
snehal
Seventeen Stars

Re: Import .sql file in mysql data base using talend

have a look at those more practical example :
http://stackoverflow.com/questions/5152921/import-sql-file-from-mysql-console
hope it helps
regards
laurent
One Star

Re: Import .sql file in mysql data base using talend

Hi laurent ,
Thank you for useful link.
i tried same procedure in cmd. it working there. The command is:
C:\xampp\mysql\bin>mysql -u root demo<C:/xampp/mysql/bin/localhost.sql

but the same command is not working in tSystem. The command is:
"cmd C:/xampp/mysql/bin>mysql -u root demo<C:/xampp/mysql/bin/localhost.sql"
After Running this , it is giving as follow:
Starting job sqlfile at 10:51 04/09/2013.

connecting to socket on port 3440
connected
Microsoft Windows
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\talend\TOS_DI-Win32-r104014-V5.3.1>
disconnected
Job sqlfile ended at 10:51 04/09/2013.

When i checked demo database its not contain the schema.
so can you please tell me where i am wrong. because here error also not showing
Regards
snehal