can somebody help me - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

can somebody help me

Ajay PatelAjay Patel Posts: 13Member
i want to store the date in format yyyy-mm-dd as i am using mysql. i have written code in jsp to convert the format dd-mm-yyyy in above fromat working fine.,but when i am entering the fields in front page it is not updating the database and giving the fallowing error.

i have written servlet for that
the servlet is

import javax.servlet.*;
import javax.servlet.http://http.*;
import java.sql.*;

public class ReservationServlet extends HttpServlet {

Connection dbConn = null;
public void init(ServletConfig conf) throws ServletException
} // end init

public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException


PrintWriter out = res.getWriter();
String myInstance = req.getParameter("Instance_Name");
String myFromDate = req.getParameter("final1");
Integer myFromTime = Integer.valueOf(req.getParameter("From_Time"));
String myToDate = req.getParameter("Till_Date");
Integer myToTime = Integer.valueOf(req.getParameter("Till_Time"));

Integer number = new Integer(0); // Would store the allocation number
Integer project_no = new Integer(0); // would store the project number
Integer Project_Manager = new Integer(0); // Would store the project manager number
String Email_Id = null; // Would store the email id of the projectr manager

boolean bool;
if (myInstance.length() != 0)

out.println("database created" + myFromDate + myFromTime);
out.println("database not created");

if (dbConn == null)
out.println("there is nothing in the database");


project.DaoAllocation obj = new project.DaoAllocation(dbConn);


//Setting ofinstance name
//Searching for a Allocation Number which can be reserved
if(obj.FetchFreeRecord()) {
number = obj.getM_allocation_no();
project_no = obj.getM_project_no();
out.println("RESERVATION RECORD" + number + project_no);
Searching for the appropriate Project Manager Number
project.DaoProject ProjectObj = new project.DaoProject(dbConn);

if(ProjectObj.fetchByPk(project_no)) {
Project_Manager = ProjectObj.getM_project_mngr_no();
out.println("manager no =" + Project_Manager);
Searching for the appropriate Project Manager Email Id
project.DaoEmployee EmployeeObj = new project.DaoEmployee(dbConn);

if(EmployeeObj.fetchByPk(Project_Manager)) {
Email_Id = EmployeeObj.getM_employee_email_id();
out.println("manager email =" + Email_Id);

project.DaoReservation ReservationObj = new project.DaoReservation(dbConn);

ReservationObj.setM_status(new Integer(2)); // 2 means Pending requests for reservation



else {
out.println("NO RECORD IS EMPTY" + number + project_no);



catch (Exception objExp){
out.println("what are you doing");
}else out.println("Please Fill In The Resource Name");

// end MyOption

//if (Employeelist==null)

/*--gaurav //add first cd to the cart
Employeelist = new Vector(); //first order
} // end if
// shount b herere } // end do post

session.putValue("Employee.Employeecart", Employeelist);
String url="/jsp/employee.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(req, res);
--- gaurav */


private boolean establishConnection()



//dbConn = DriverManager.getConnection(prompt("JDBC URL: ", "jdbc:mysql:///brocade_lab"),
// prompt("User Name: ", "root"),
// prompt("Password: ", "gaurav"));
dbConn = DriverManager.getConnection("jdbc:mysql://localhost/brocade_lab","root","gaurav");
return true;

}catch (ClassNotFoundException cnfe) {
System.err.println("Error lodaing" + cnfe);
return false;
catch(SQLException se){
return false;
}catch(Exception s){
return false;

} // end of establisConnection()


but when i am submitting the page it is giving error

database creatednull1 RESERVATION RECORD61 manager no =22 manager email =[email protected] what are you doing java.lang.IllegalArgumentException
Sign In or Register to comment.