Ant Script to Create Mysql Table
This example illustrates how to create table through the build.xml file
by simply running the ant command. In this build.xml file, we are
using 4 property elements for connectivity of database. The first property <property
name="sql.driver"> is used to connect the sql driver. The
second property <property name="sql.url"> is used to
define the database url and database name. The third property <property
name="sql.user"> is used to define user name of the database.
The fourth property <property name="sql.pass"> is used
to define the password name of the database.
In this build.xml file, only one target <target name="createTables"> is used to execute the query which is in the client.sql and project.sql file. The source code of the build.xml file is as follows:
|
client.sql
create table client ( |
project.sql
create table project ( |
Create the both client.sql and project.sql files with the build.xml file and simply run the build.xml file with ant command in the appropriate path on command prompt. If the program executes successfully, then the following output will be displayed.