ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Creating a Web Application with Ant and Tomcat 4
Subject:   Fix for id after deleting records
Date:   2006-02-07 04:26:54
From:   nav327
Problem


After deleting multiple entries the id field (auto_increment) does not reset creating non sequential id numbers.


Fix
Edit the public int deleteAddress method inside AddressesDB.java by inserting...


String alter_increment ="alter table addresses auto_increment=1";


and by adding inside the try block


Statement stmt= this.connection.createStatement();
stmt.execute(alter_increment);


**before realeasing the connection this.releaseConnection ();**


use ant to remove and install the application again.