Aaah... time once again for the
how-does-the-server-know-when-the-user-clicks-stop thread...
Vijaya Bhaskar Varanasi wrote:
>
> My question is what should be done when the SUBMIT button in the html form
> is hit and immediately STOP button of the browser is clicked ? Right now,
> the servlet runner is throwing a java.net.SocketException : Socket Write
> error (code = 10053) after some time of hitting the STOP button. But, still
> I am able to see the values inserted into the Access DB !
>
> I have tried con.setAutoCommit(false) and con.commit() and con.rollback()
> at (supposedly) appropriate places (here con is the Connection object) No
> use. Can anybody please give me a tip to solve the problem ?
There is no good, easy solution. As you have discovered, when the user
clicks stop (or clicks a bookmark or link) the browser DOES NOT send
that information to the server. Once the browser has sent the end of
request "marker," the HTTP request is complete, and there's no way to
send more information to the server (as part of the same request).
Usually the way the server finds out is when it tries to send the
response back and gets an IOException (SocketException IS_A
IOException).
I have very little experience with Access so this is just a guess:
Access does not support transactions; that is why trying rollback might
not work. If Access does support transactions, then setting auto commit
to false and using commit or rollback should work. By the way, where are
those "appropriate places?" It seems to me the appropriate place would
be the catch or finally block after you've caught the IOException. If
Access does not support transactions, you might try calling
executeUpdate after you've sent the response; that way, if you get an
IOException, you can avoid the update. Of course, if your response
includes feedback from inserting the data, this won't work.
You might try searching the archives for more information because the
stop button issue has been discussed many times before.
K Mukhar
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html