Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean deleteStudent(String [] ids) {
- Connection connection = null;
- String query;
- boolean result = false;
- try {
- Context initCtx = new InitialContext();
- Context envCtx = (Context) initCtx.lookup("java:comp/env");
- DataSource ds = (DataSource) envCtx.lookup("jdbc/cmsDB");
- connection = ds.getConnection();
- QueryRunner run = new QueryRunner(ds);
- query = "delete tbl_student where student_id";// what should i put here???
- int nor = run.update(query, ids); //nor = no of records
- if (nor > 0) {
- result = true;
- } else {
- result = false;
- }
- } catch (NumberFormatException e) {
- // e.getMessage();
- e.printStackTrace();
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- DbUtils.closeQuietly(connection);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement