Not able to insert data?
I am not able to insert the data. Am getting a compilation error . The below is my code.I have given the servername,database name,username,password in the original program.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.*;
import java.lang.String;
publicclass Jinsert
{
publicstaticvoid main(String args[])throws IOException
{
Connection con =null;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
String driverName ="com.mysql.jdbc.Driver";
Class.forName(driverName);
String serverName =" ";
String mydatabase =" ";
String url ="jdbc:mysql://" + serverName +"/" + mydatabase;
String username =" ";
String password =" ";
con = DriverManager.getConnection(url, username, password);
System.out.println("Connected");
Statement stmt =null;
ResultSet rset =null;
String HolidayDate;
String Description;
stmt = con.createStatement();
System.out.println("Enter Holiday Date : ");
HolidayDate=br.readLine();
System.out.println("Enter Description : ");
Description=br.readLine();
stmt.excuteUpdate("insert into Holiday (HolidayDate, Description) values (' "+HolidayDate+" ',' "+Description+"')");
System.out.println("Data inserted");
}
catch(Exception e)
{
System.err.println("Exception: " + e.getMessage());
}
finally
{
try
{
if(con !=null)
con.close();
}
catch(SQLException e)
{
}
}
}
}
This is the error which is generated:
Jinsert.java:42: cannot find symbol
symbol : method excuteUpdate(java.lang.String)
location: interface java.sql.Statement
stmt.excuteUpdate("insert into Holiday (HolidayDate,Description) values (' "+Hol
idayDate+" ',' "+Description+"')");
^
1 error
Database is MYSQL. I have created a table called Holiday. The fields are HolidayDate which is of date datatype and Description is of varchar datatype.
what is the mistake. please help.

