DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2007

    how to delete entry in a database through java servlet run in eclipse??

    Hello , I need help editing this java code which aims to delete an entry from a database run by mysql. this code will be run through eclipse. I already tried to edit and made sure all variable names and types were correct but it just would not work. Please help! thanks a lot!!!

    public String delResolution(int id)
    ConMan con = new ConMan();
    Statement stmt = con.logOn().createStatement();
    String msg = "";
    String sql = "delete from ledger where id="+id;
    if (stmt.execute(sql))
    msg = "Delete failed";
    } else
    msg = "Delete successfully";
    return msg;

    catch (SQLException e)
    return "Delete. SQL error " + e.getMessage();
    catch (java.lang.NullPointerException ne)
    return "<p>Null error: " + ne.getMessage();

    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Welcome to DevX

    Does it return an error or just not work?

    (Also, please do not post duplicate threads in different sections for the same question. Thanks. )

Similar Threads

  1. Database not properly created
    By Arjuna in forum Database
    Replies: 2
    Last Post: 07-25-2007, 03:22 AM
  2. Replies: 7
    Last Post: 10-17-2005, 11:51 PM
  3. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 06:46 AM
  4. .NET vs. Enterprise Java: Who's Got Better Security?
    By Glen Kunene in forum Talk to the Editors
    Replies: 17
    Last Post: 03-23-2002, 12:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.