public String connectWithDetail(Student student) { try { connectWithMySql(); String sql = "INSERT INTO webservicedemo (Name, Roll, Mobile, Email, Pass) VALUES (?,?,?,?,?)"; PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1, student.getName()); ps.setString(2, student.getRoll()); ps.setString(3, student.getMobile()); ps.setString(4, student.getEmail()); ps.setString(5, student.getPass()); int n = ps.executeUpdate(); if (n > 0) { ret = "SUCCESS"; } } catch (SQLException e) { ret = "ERROR"; } finally { if (conn != null) { try { conn.close(); } catch (Exception e) { e.printStackTrace(); } } } return ret; }