how to redirect stdin to java Runtime.exec ?

Posted by jprogram2010 on Stack Overflow See other posts from Stack Overflow or by jprogram2010
Published on 2010-04-01T20:10:08Z Indexed on 2010/04/01 20:13 UTC
Read the original article Hit count: 460

Filed under:
|
|
|

I want to execute some sql scripts using Java's Runtime.exec method. I intend to invoke mysql.exe / mysql.sh and redirect the script file to this process. From the command prompt I can run the command

<mysqInstallDir\/bin\mysql.exe -u <userName> -p <password> < scripts\create_tables.sql

I can invoke mysql.exe using Runtime.exec but how do I redirect data from sql file to mysql.exe ?

© Stack Overflow or respective owner

Related posts about java

Related posts about redirection