try this.. it works
{
PreparedStatement pst1 = conn.prepareStatement("select max(id)+1 from artist_reg_ml");
ResultSet rs = pst1.executeQuery();
String user_id ="" ;
while(rs.next())
{
user_id = rs.getString(1);
}
String sql = "insert into artist_reg_ml (id,uname,pwd,email,country) values (?,?,?,?,?)";
PreparedStatement pst = conn.prepareStatement(sql);
pst.setString(1, user_id.toString());
pst.setString(2, uname);
pst.setString(3, pwd);
pst.setString(4, email);
pst.setString(5, country);
int i = pst.executeUpdate();
String msg = "";
if (i != 0) {
HttpSession sess = request.getSession();
sess.setAttribute("uname", request.getParameter("uname"));
sess.setAttribute("pwd", request.getParameter("cpwd"));
File dir = new File("C:/Users/Naresh/Documents/NetBeansProjects/Registrationform/web/nameoffolder/" + uname);
dir.mkdir();
RequestDispatcher dispatcher = request.getRequestDispatcher("/mypage1.jsp");
dispatcher.forward(request, response);
}