Below, there's code that should insert information to the MySQL database. It works without exceptions, but does not insert information to the database.
try {
Class.forName("Com.mysql.jdbc.Driver");
Connection connection= DriverManager.getConnection("jdbc:mysql:///mymail","root","toor");
out.print("Connected");
PreparedStatement ps= connection.prepareStatement("insert into mytable(fname,lname,uname,pass,cpass,month,day,year,Gender,mobile,email,country) values (?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1, fname);
ps.setString(2, lname);
ps.setString(3, uname);
ps.setString(4, pass);
ps.setString(5, cpass);
ps.setString(6, month);
ps.setString(7, day);
ps.setString(8, year);
ps.setString(9, Gender);
ps.setString(10, mobile);
ps.setString(11,email);
ps.setString(12, country);
ps.executeUpdate();
} catch (Exception e)
{}
e.printStackTrace();for viewing full trace orSystem.out.println(e);for viewing the exception alone.. P.S: Always remember to post your exceptions or errors when you ask a question. That will help us in answering your question better. We cant assume all possible errors.. So, to get the right answer post your errors/exception