Java mysql的Ant构建失败
当我使用mysql运行Ant构建时,会出现以下错误Java mysql的Ant构建失败,java,mysql,ant,build,Java,Mysql,Ant,Build,当我使用mysql运行Ant构建时,会出现以下错误 Cannot run program "mysql" (in directory "D:\Projects\OBSWorkspace\schoolforms\db"): CreateProcess error=2, The system cannot find the file specified 当我在本地cmd中运行mysql时,会出现以下消息 ERROR 1045 (28000): Access denied for
Cannot run program "mysql" (in directory
"D:\Projects\OBSWorkspace\schoolforms\db"):
CreateProcess error=2, The system cannot find the file specified
当我在本地cmd中运行mysql时,会出现以下消息
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password:
NO)
如何运行ant从脚本生成和创建数据库。首先,您需要尝试通过cmd行与mysql连接,例如int this way mysql-u root-p root,以知道您能够做到这一点。其次,您可以使用以下代码从ant build执行此操作:
<project name="mysql.test" default="mysqltest">
<target name="mysqltest">
<exec executable="cmd.exe">
<arg value="mysql" />
<arg value="-u root" />
<arg value="-p root" />
</exec>
</target>
</project>
您可能尝试不通过cmd进行连接,这就是您无法连接的原因。看起来mysql没有安装。你在做什么?您是在构建Java项目还是使用Ant作为shell脚本/批处理语言?您希望实现什么?为什么要通过ant连接到mysql?请添加您实际使用的代码。一个java项目…………但我有一个问题……谢谢大家。