File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "MS Access" Watch "MS Access" New topic

MS Access

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
I have a strange thing happening in my application that uses MS Access database. I have a page that stores information in a database. The database that I am using was populated by someone else, so I am using it for my servlet. Database has a coulmn called ID which serves as a primary key and has an "Auto Number" property. Here is a problem: every time I INSERT a new data through either SQL or manually, the numbers in ID column do not show up correctly. So if the last row had id 105, the one I insert after it become 110 and then 111,112,113,114 and so on...If I erase all entries after 110, and enter new ones they start with 120,121...and then 130, get the picture.
Why is this happening?
(sorry if question is too long)

All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
This happens in Sybase also. It is because the DB grabs a block of numbers at a time and then drops whatever isn't used. In Sybase this only happens on a crash.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Is there any way to fix it, or do I have to re-papulate the whole table?
I agree. Here's the link:
subject: MS Access
It's not a secret anymore!