how to redirect stdin to java Runtime.exec ?
- by jprogram2010
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 ?