We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
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.
|