to execute a mysql command like "mysql my_db -ufoo -pbar <server/resource/sql/mysql/foo/create_tables.sql" from mysql use the input attribute to pass standard input <exec executable="mysql" dir="${basedir}/${build}" input="${basedir}/resource/sql/mysql/foo/seed_data.sql"> <arg value="${sql.db_name}" /> <arg value="-u${sql.db_username}" /> <arg value="-p${sql.db_password}" /> </exec> Note this is after Ant 1.6 before Ant 1.6 use the task. The only thing I dont like about it is that you have to set the classpath for the driver.