i am having the following code & i'm calling it through the jsp page but it giving me the
NullPointerException
at this line
cs.setDate(6,(Date)df.parse(ptechdatabean.getFrom_Date()));
as i m using java, jsp, jdbc, oracle 10g can someone tell me why this is so....
package Ptech;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.sql.Date;
public class User_Master_procedure {
public ArrayList Call_User_Master_procedure(PtechDataBean ptechdatabean) throws ClassNotFoundException, SQLException, ParseException {
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
DatabaseConnection db = new DatabaseConnection();
Connection Connect = db.Oracle_Connect();
CallableStatement cs = Connect.prepareCall("{call Pr_User_Master_Insert(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
cs.setString(1, ptechdatabean.getCompany_id());
cs.setString(2, ptechdatabean.getBranch_id());
cs.setString(3, ptechdatabean.getUser_id());
cs.setString(4, ptechdatabean.getName());
cs.setString(5, ptechdatabean.getPassword());
cs.setDate(6,(Date)df.parse(ptechdatabean.getFrom_Date()));
cs.setDate(7,(Date)df.parse(ptechdatabean.getTo_Date()));
cs.setString(8,ptechdatabean.getStatus());
cs.setInt(9, ptechdatabean.getEntered_By());
cs.setDate(10,(Date)df.parse(ptechdatabean.getEntered_Date()));
cs.setInt(11, ptechdatabean.getUpdated_By());
cs.setDate(12, (Date)df.parse(ptechdatabean.getUpdate_Date()));
cs.setString(13, ptechdatabean.getIp_Address());
cs.setString(14, ptechdatabean.getMac_Address());
cs.setString(15, ptechdatabean.getCard_Id());
cs.setString(16, ptechdatabean.getUser_Name());
cs.setString(17, ptechdatabean.getFlag());
cs.registerOutParameter(18, Types.VARCHAR);
cs.registerOutParameter(19, Types.VARCHAR);
cs.executeUpdate();
Connect.commit();
ArrayList al = new ArrayList();
{
al.add(cs.getString(18));
al.add(cs.getString(19));
}
return al;
}
}