This example illustrates how to insert data in 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 from database. The first
element <property name="sql.driver"> is used to connect
from the sql driver. The second element <property
name="sql.url"> is used to define the database url and
database name. The third element <property name="sql.user">
is used to define user name of the database. The fourth element <property
name="sql.pass"> is used to define the password name of the
In this build.xml file, <target name="createTables"> is used to execute the query which is in the client.sql and project.sql file and <target name"insertData"> is used to execute the query which is in the insertclient.sql and insertproject.sql file. The source code of the build.xml file is as follows:
<project name="MysqlCreateTableAndInsertData" basedir="." default="insertData">
create table client (
create table project (
INSERT INTO client (client_name) VALUES ("Galanthus
INSERT INTO project (project_name) VALUES
Create the all client.sql, project.sql, insertclient.sql, insertproject.sql files parallel of 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.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.