Hello, I'm writing a simple website that reads and allows entries from a MS-Access database to be updated.
I have got it to work. But with the first column name 'Client_ID', I cannot seem to update this the same way as with the other column variables. All the column names are stored in an array at the top of servlet. There is a JSP that calls the doPost method of the servlet. This then shows the results of a single row of the Remote.mdb database(clients table). After pressing a sumbit button at the bottom of page, the doGet method is called which calculates the required ROW number, so that doPost will then show the required row. When TYPE=3, every entry in the specified row, is updated, using
for some reason starting the lp at 0, so as to allow the 'Client_ID' variable to change does not work, so I have done it differently. But I don't understand why this is happening, and it is really annoying.
The Remote.mdb database includes 1 table called clients. The column names going from left to right are: ID (1,2,3,...) Client_ID (123,456,789,...) First Name (Jim, John,..) and so on.. I don't think the fact the Client_ID is the 2nd column has anything to do with this. I have displayed the servlet code below, any ideas to why I can't start the for loop at 0 are much appreciated.
Firstly, and quite importantly: your servlet contains local variables and is therefore not thread safe. Search the Servlet forum for this issue.
Problems of the type you are seeing are usually due to a problem with the Type-1 Driver. Better not to use it, but sadly people insist on using Access for their database. See the last two posts here.
Maximilian Xavier Stocker
Joined: Sep 20, 2005
I am not sure that saying to never use Access is the best idea in the world. My experience suggests that the philosophy of different tools for different jobs is very applicable.
As far as the original problem. Besides the issues about thread safety raised previously I have a feeling the problem is that you are trying to update a column that is a primary key autonumber column. I think largely an operation of that type should not be attempted... I cannot forsee a need to change a surrogate key like that. If you really must then you need to make sure that the new value does not conflict (with an existing value) and it is otherwise valid and that you are not breaking any foreign key dependencies when you make that change.