Releasing table locks when user closes browser

Hi, I've read the blogs and tried some of the code that people have suggested but it just never seems to work.  I have locked table entries belonging to a stateful 2003 BSP.  The user closes the browser by means of the 'X' and the table locks remain.  I have table lock releases in the 'OnDestroy' event but that never seems to occur.  I have tried inserting JavaScript to capture the closing of the window but either it captures every other event or it gets confused when navigating to another page.  I have the redirect examples however they all seem to be part of a proper logoff procedure, rather than the cowboy approach of just shutting down the browser.  There must be a simple procedure out there to do this.  Is there a complete example somewhere?
Any help will be appreciated,
Kevin

Hi Raja, ok I discovered why it isn't working and it really is quite obvious.  The browser that it's being tested on has a Google toolbar installed. Among other things this toolbar allows users to block the display of popups.  If this is selected the script will not run properly as it needs the alert to allow the server side to run.  This is going to be frustrating because while most of the user's desktop is managed by the corporation they still have the ability to add toolbars to their browsers and configure them, and I'm sure most people will select the popup blocker. 
Kevin

Similar Messages

  • Call JavaScript when user closes browser containing webcenter

    Hi
    Scenario:
    1. Webcenter is opened in a browser.
    2. User closes the browser
    Requirement:
    - When user closes browser containing webcenter, a java script (or a servlet) should get called.
    As you know, we can call a script in 'onunload()' of body tag.
    But how do we call it with webcenter?
    Thanks.
    Edited by: 873687 on Dec 14, 2011 5:34 AM

    Here is a few links that I found for the JavaScript side you might play aroudn with.
    http://developer.irt.org/script/1230.htm
    http://www.webreference.com/js/tutorial1/reference.html
    http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20953676.html
    http://www.devguru.com/Technologies/ecmascript/quickref/window.html
    And two in German
    http://www.uni-magdeburg.de/service/www/books/muenz/javascript/objekte/window.htm
    http://www.exine.de/clientseitig/js_work_events.htm

  • How to capture when user closes browser

    I am implementing a scenerio where I need to reset login status in the database to false when a user closes browser without logout. I am at fix, how do I do that ????? With the java script solution, its a browser dependent and may not work with all the browser. With java sessionListener, the sessionDestroyed() method is never called when browser is closed.
    Plz. help... how can I capture the browser closing event. My application is running on Websphere and integrated with active directory for authentication and authorization.
    Thanks in advance......

    SoulTech2012 wrote:
    what about HttpSessionBindingListener?
    javascript solution doesn't sound good to me"hack" was chosen for that reason. Currently, there are no real good solutions for this. The browser runs autonomously from the server so there is not a lot that can be done. HttpSessionBindingListener is intriguing but I bet when the browser is x'd out of there is nothing sent to listen to.
    The first reply "reasonable timeouts" is the most relied on solution. All others are a lot of work for iffy pay back at best. This is one of the issues that has forced me into rather strict no session solutions.

  • Detecting when user closes browser or moves to another site

    How can detect when a user has closed the browser or moved to another website

    No, it doesn't automatically fire any request to the server or so. Best what you can do at the server side is intercepting the session destroy using HttpSessionListener. You can also let Javascript fire a (ajaxical) request to the server side notifying that the onunload/onbeforeunload has occurred.
    Difference between onunload and onbeforeunload is by the way that the onbeforeunload can still prevent the page actually being left using a warning message like "are you sure to leave page?" and that it is NOT supported by w3 specification and thus not guaranteed to be supported in all webbrowsers (as far under each Opera -which very strictly follows the standards- doesn't support it).
    Edited by: BalusC on 25-aug-2009 11:04

  • Release table lock

    how to release table lock in Oracle?

    If you know the sid and serial# (query V$SESSION for that) of the other user then you (or your DBA) can issue:
    SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';
    http://www.oracle-base.com/articles/misc/killing-oracle-sessions.php

  • Record locks created when user closes the Browser and not the Web Form

    Hi. We sometimes encounter the issue where a user updates a record, locking the record on the table, but then they unexpectedly closes the browser without saving by clicking the X in the upper-right of the browser window. Then when another user comes along and attempts to edit that record they get the message Unable to Reserve Record. The orphaned record lock eventually does seem to clear itself out, but that can often take 15-20 minutes.
    Is there any way to speed this up? Or to pragmatically keep this from occurring? Either on the database side or with some code in a particular application?
    Please let me know your thoughts. Thanks in advance.

    If a user closes the browser window the forms runtime on the application server holding the locks is in most cases still up and running. The FORMS_TIMEOUT controls on how long a forms runtime on the server is up and running without the client applet not sending a heartbeat (See MOS note 549735.1). By default this is 15 minutes which would explain your locks being held 15 minutes.
    You could decrease the FORMS_TIMEOUT in the default.env, so the forms runtimes get cleaned earlier and thus the locks get released earlier.
    Note that if you have blocking client_hostcalls with webutil this might be a problem, as it prevents the forms applet from sending the heartbeat and after the FORMS_TIMEOUT passed while the forms applet is blocked the forms runtime on the server gets closed.
    cheers

  • Show Confirmaiton Dialog when user closes the browser

    Hello All,
    Can we show a confirmation dialog when user chooses to close the browser in which applet is running? I know that it can be done using javascript. Can it be done using java code?
    Please suggest.
    Thank you.

    teejrama wrote:
    ..Can we show a confirmation dialog when user chooses to close the browser in which applet is running?.. You can pop a JOptionPane in the applet's destroy() method, but that will not do any good, since the browser is not asking the applet for advice on whether it is closing, it is telling the applet it is closing.
    ..I know that it can be done using javascript... Can it? How?
    If so, that would be another good reason to disable JS.
    ..Please suggest.I suggest you presume the end-user is smart enough to know when they want to close their own browser, and not interfere in that process.
    Thank you.No worries.

  • Session does not end even when i close browser

    when i close firefox/IE the session continues ,What i need is that i am adding amount in shopping cart ,but the amount adds to old amount even when i open a new browser window ,
    i hv checked that my browser will remove cookies when i will close mozilla
    i hv also printed total=0 in servlet's ini method but the init method is called only once and total does not reset to 0,does 'th the call to init method is made everytime we start a new session via browser ,it does not get called whn i close the current browser and open new one.how to destroy the older servlet?
    I m using s=request.getSession()
    and s.setAttribute("billamnt",total)
    the code of the servlet is
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class addtocart extends HttpServlet
         HttpSession s;
         PrintWriter pw;
         int total,cam,mob;
         public void init()
              total=0;
              cam=0;
              mob=0;
              System.out.println("inside  cart init");
    public void service(HttpServletRequest req,HttpServletResponse res) throws IOException
         s=req.getSession();
        res.setContentType("text/html");
         pw=res.getWriter();
         pw.println("<html><body><a href="+"mobs"+">Mobile</a><br><a href="+"cams"+">Camera</a><form method = "+"post "+"action ="+"bill"+"><br><input type= "+"submit"+"></form></body></html>");
        if(req.getParameter("csony")!=null)
        cam=cam+Integer.parseInt(req.getParameter("csony"));
        if(req.getParameter("clg")!=null)
        cam=cam+Integer.parseInt(req.getParameter("clg"));
        if(req.getParameter("cnokia")!=null)
        mob=mob+Integer.parseInt(req.getParameter("cnokia"));
        if(req.getParameter("cerricson")!=null)
        mob=mob+Integer.parseInt(req.getParameter("cerricson"));
        s.setAttribute("cambill",new Integer(cam));
        s.setAttribute("mobbill",new Integer(mob));
        s.setAttribute("billamnt",new Integer(cam+mob));
    public void doPost(HttpServletRequest req,HttpServletResponse res)
    public void doGet(HttpServletRequest req,HttpServletResponse res)
    }Wats the problem?
    Message was edited by:
    pooja_k_online

    The servlet is not created on a session basis. All users share the same servlet object. The servlet is created once when the servlet is first called in the context, then is maintaned until the server shuts down.
    You should not store any state in the servlet. You should use the HttpSession object you get from the request object to store the totals, and all other values. You should not use the servlet to hold on to a session object, as multiple users would see the SAME session that way. If you need to use the session in multiple methods, then you should pass that object as parameter, not by making it a class member.
    You also shouldn't put the work in the service method of the HttpServlet. You should put it in either the doGet or doPost method (and if you want to make it happen for both type requests, call doPost from the doGet method and put the work in the doPost method).
    For example:
    public class ShoppingCartServlet extends HttpServlet {
      public void doGet(HttpServletRequest request, HttpServletResponse response) {
        doPost(request, response);
      public void doPost(HttpServletRequest request, HttpServletResponse response) {
        HttpSession session = request.getSession();
        Integer cambill = (Integer)session.getAttribute("cambill");
        int cam = 0;
        if(cambill != null) cam = cambill.intValue();
        Integer mobbill = (Integer)session.getAttribute("mobbill");
        int mob = 0;
        if(mobbill != null) mob = mobbill.intValue();
        Integer billamnt = (Integer)session.getAttribute("billamnt");
        int total = 0;
        if(billamnt != null) total = billamnt.intValue();
        String csony = request.getParameter("csony");
        if (csony != null) cam += Integer.parseInt(csony);
        String clg = request.getParameter("clg");
        if (clg != null) cam+= Integer.parseInt(clg);
        String cnokia = request.getParameter("cnokia");
        if (cnokia != null) mob += Integer.parseInt(cnokia);
        String cerricson = request.getAttribute("cerricson");
        if (cerricson != null) mob += Integer.parseInt(cerricson);
        total = cam + mob;
        session.setAttribute("cambill",new Integer(cam));
        session.setAttribute("mobbill",new Integer(mob));
        session.setAttribute("billamnt",new Integer(total));
        PrintWriter pw=response.getWriter();
        pw.println("<html><body><a href="+"mobs"+">Mobile</a><br><a href="+"cams"+">Camera</a><form method = "+"post "+"action ="+"bill"+"><br><input type= "+"submit"+"></form></body></html>");
        pw.close();
    }Message was edited by:
    stevejluke

  • BPEL Toplink Adapter not releasing table lock

    We have a bpel process that attempts to do a merge on an Oracle table through the database adapter. If the merge operation is unsuccessful for any reason the process retries for a set number of times. We have found that a lock is generated on the tables in question and not released the first time. When the process retries it then hangs as it is waiting for the locks to be released.
    We are using version 10.1.2.0.2
    Thanks,
    Ashley

    Hi Ashley,
    I don't believe this is related to cache settings.
    Lets say a merge writes several rows and then fails updating the last row, at this point it has locks on the first n - 1 rows. The merge never acquires read locks.
    Because the merge failed though, the transaction is rolled back, locks always get released on a roll back.
    I confirmed with Glenn that when the bpel engine catches an exception, that transaction is ended (releasing all locks either way), and the next retry occurs in a new transaction.
    Some guesses I have:
    -in 10.1.2.0.2 turn on usesBatchWriting="true", then all the writes will happen in one statement.
    -whenever a bpel process waits between steps, if the wait time is very small the instance may be kept in memory. This could mean that the next retry occurs in the same transaction as the first, so maybe you could try increasing the retry interval?
    -investigate why merge is failing at all, maybe it failed in the first place because another process had a lock on the rows.
    Thanks
    Steve

  • How to release table locks?

    I was running Data Services (4.0 SP2) to load data into Hana (1.0 SP2 patch 20) using the Bulk load option. Apparently, the DS process hung and now the table I was writing to is locked although the DS Job is dead. How do you release the table lock without restarting Hana DB?

    Hello Sachin,
    you could try these statements. The first one will cancel the currently executed operation, the second one will disconnect the idle session:
    ALTER SYSTEM CANCEL SESSION session_id;
    ALTER SYSTEM DISCONNECT SESSION session_id;
    Regards,
    Mark

  • Force end of session when user closes window without logging out

    I want to protect sensitive employee data. Does anyone know how to force a user's portal session to be terminated after a user closes a window with the "X" instead of logging out?

    Web application is connectionless. So there is no way to tell if a user has disconnected. If the user diligently logout, then invalidating a session is no problem. However, if you wish to invalidate the user upon closing of window, I suggest you drop that idea and change to different approach.
    1. If you are trying to impose single logon policy, you may consider invalidate an existing session if the same user login again.
    2. If you really need to invalidate a user session as soon as he is inactive (or closes window). I suggest you set a very small timeout interval (maybe 3 minutes). Then for all the pages, implement a simple invisible IFRAME that will keep refreshing itself (say every 2 minutes) on a dummy JSP/servlet URL. The fact that this IFRAME always hit the URL at 2 mins interval will keep the user session valid. Once the browser window is closed, the session will be invalidated in max 3 mins time.
    The final suggestion is to drop that idea altogether, the point is ... implement such feature is like twisting web application to do something that it is not design to do naturally.

  • Release of locks when transaction commits

    hi guys,
    I am reading Expert Oracle by Tom Kyte, and I am a bit confused. I have checked the errata (http://www.apress.com/book/downloadfile/2421), and no one has pointed the bit I am confused about as an error, so maybe it is just my understanding that is flawed.
    Tom says that when a COMMIT happens, amongst other things:
    "*all locks held by our session are released*".
    Now this is confusing me. Why are all locks held by the SESSION released? I thought we would just release the locks held by the transaction. I mean, our session could have many transactions happening in it, yes? Why then would we need to release all locks?
    thanks

    A single session has a single transaction (barring the corner case of autonomous transactions-- I don't recall off the top of my head if autonomous transactions were available when this book was first released). Oracle doesn't support nested transactions, though you can set savepoints and roll back to a savepoint.
    JustinNow I am confused! Say I open up my PL/SQL Developer, and connect to a database. I now have one session running. I can then open up the "SQL window", and do a transaction, and at the same time, within the same PL/SQL Developer, I can open up another "SQL Window" and do another transaction (I havent done this yet, transactions is a topic I have not yet covered in depth, I am just learning about rollbacks and redo at the moment). So I am assuming I can have two concurrent transactions running from the same session. Is this incorrect? Judging from your response, this is wrong, and I cannot do the above in PL/SQL Developer.
    thanks

  • Force code execute when user closes OOB lightswitch app using the windows close red X

    I've created a lightswitch app using Forms Authentication.  If the user closes the application using the window close red 'X', I need to update a custom user profile table.  Is this possible?

    I use this code and it works!
    I handle the closing event of the user and I break it, execute my code ed after closing the application.
    Under you see the code that I use in my application.vb :
    Public Class Uscita
    ' Dichiara un evento per la classe
    Public Event Event1()
    ' Definisce un metodo per richiamare l'evento
    Sub CausaEvento()
    RaiseEvent Event1()
    End Sub
    End Class
    Protected Sub EsceAPP()
    Dim Obj As New Uscita
    AddHandler Obj.Event1, AddressOf Me.EventoUscita
    ' Provoca l'esecuzione dell'evento
    Obj.CausaEvento()
    End Sub
    Sub Eventouscita()
    Dispatchers.Main.BeginInvoke(Sub()
    RemoveHandler _mainWindowClose.Closing, AddressOf MainWindow_Closing
    System.Windows.Application.Current.MainWindow.Close()
    End Sub)
    End Sub
    Private Sub Application_loggedin()
    Try
    Dispatchers.Main.BeginInvoke(Sub()
    _mainWindowClose = System.Windows.Application.Current.MainWindow
    AddHandler _mainWindowClose.Closing, AddressOf MainWindow_Closing
    End Sub)
    Catch ex As Exception
    MessageBox.Show(ex.Message)
    End Try
    End Sub
    Private Sub MainWindow_Closing(ByVal sender As Object, ByVal e As ClosingEventArgs)
    If MessageBox.Show("Vuoi Veramente uscire?", "Conferma", MessageBoxOption.OkCancel) = Windows.MessageBoxResult.Cancel Then
    'Elimina l'uscita utente
    e.Cancel = True
    Else
    'Interrompe momentaneamente l'uscita dell'utente per eseguire l'aggiornamento della tabella utenti loggati
    e.Cancel = True
    'Aggiorna la tabella utenti loggati ed esce dall'applicativo
    Me.Details.Dispatcher.BeginInvoke(Sub()
    Dim ws = CreateDataWorkspace()
    Dim query = ws.ApplicationData.UtentiLoggatis.Where(Function(c) c.UserName = Me.User.FullName).FirstOrDefault
    query.OnLineImage = MyImageHelper.GetImageByName("RedLight.png")
    query.OnLIne = "OFF"
    query.Logout = Now
    ws.ApplicationData.SaveChanges()
    'Chiama la routine per uscire dall'applicazione
    EsceAPP()
    End Sub)
    End If
    End Sub

  • Ending session when user closes window w/o logging out

    Hi,
    I tried looking everywhere for a solution to this problem and was unable to do so. I'm running tomcat 4.0.5 on win2k and am trying to prevent multiple user logging capability, but the listeners that I implemented for the session can only detect the creation of the session, and the destruction after the pre-set session invalidation time. So if the user closes the window 15 minutes into the session, the server still has the flag for "logged in" in place and the user cannot log in for the remainded of the session time (which is another 15 minutes).
    Can anyone please help me with this problem?
    Thank you very much,
    Lior

    How can I do that? Do you have any code I could take a look at. Thanks a lot.

  • [SOLVED] Disconnecting session when client close browser's window or tab

    Hello,
    I'm looking for disconnect my database session and invalidate the session with the "onunload" af:document function. I think that is the same as the "onunload" in "body" html tag.
    I see some documentation about that, for example:
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/document.html
    and I see that is enable to put an EL Expression, so I try with this:
    <f:view>
    <af:document binding="#{backing_user.document_user}" id="document_user" onunload="#{backing_user.logout}">
    <af:form binding="#{backing_user.form_user}" id="form_user"/>
    </af:document>
    </f:view>
    and not works, then I try:
    <f:view>
    <af:document binding="#{backing_user.document_user}" id="document_user" onunload="return logout_function()">
    <af:form binding="#{backing_user.form_user}" id="form_user"/>
    </af:document>
    </f:view>
    and as this, I try a lot of combinations, with no result. I take my time searching in various browsers but, surprisingly, I fount not much information about this (rare, I think is a very interesting matter).
    What is the way to be able this funcionallity?
    Thanks,
    Westh
    Edit: obviusly, logout_function() is a correct javascript function :P

    Hello,
    I resolve my problem. Now I go to describe the steps in a little tutorial.
    Remmember that this is a very basic tutorial that only allow you to do this matter, but not in deep. See bottom links for more information.
    Step's list:
    1) Download Shale framework from http://shale.apache.org/index.html#download
    2) Import all .jar libraries in your application.
    3) Open your web.xml file and add this:
    <context-param>
    <param-name>org.apache.shale.remoting.DYNAMIC_RESOURCES</param-name>
    <param-value>/dynamic/*:org.apache.shale.remoting.impl.MethodBindingProcessor</param-value>
    </context-param>
    4) Consider this:
    4.1) Managed bean --> userBean.java that have this method:
    public void logout () {
    /* Your logout code */
    and this name in faces-config.xml:
    <managed-bean>
    <managed-bean-name>userBeanId</managed-bean-name>
    <managed-bean-class>userBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    4.2) JSP Page --> home.jsp that have this code:
    A clinet listener:
    <af:clientListener method="unloadEvent" type="load"/>
    and this javascript functions:
    <f:verbatim>
    <script type="text/javascript">
    function unloadEvent () {
    window.onunload = function () {
    processUnload();
    function processUnload () {
    var httpRequest;
    if (window.XMLHttpRequest) {
    httpRequest = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
    httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    httpRequest.overrideMimeType('text/xml');
    httpRequest.onreadystatechange = function() { alertContents(httpRequest); };
    httpRequest.open('GET', 'dynamic/userBeanId/logout.faces', false);
    httpRequest.send('');
    function alertContents(httpRequest) {
    if (httpRequest.readyState == 4) {
    if (!httpRequest.status == 200) {
    alert('There was a problem with the request. Http code: ' + httpRequest.status);
    </script>
    </f:verbatim>
    Assuming the suffix '.faces' is mapped to the JSF servlet.
    With this, you are able to acces to logout method of userBean (using ajax) when client closes window or tab. No servlets, no 'logout.jsp' pages, etc; and the most important thing: the code never be repeat! it's funny :)
    Westh
    Resources:
    http://thepeninsulasedge.com/blog/2007/06/22/adf-faces-rc-more-on-javascript/
    http://thepeninsulasedge.com/frank_nimphius/adf-faces-rich-client-javascript-programming/
    http://www.oracle.com/technology/products/adf/adffaces/11/doc/multiproject/adf-richclient-api/tagdoc/af_clientListener.html
    http://shale.apache.org/shale-remoting/apidocs/org/apache/shale/remoting/package-summary.html
    http://shale.apache.org/shale-remoting/index.html

Maybe you are looking for

  • Arabic Numerical font is not display in PDF report output

    I am facing an issue with Arabic Numerical font, If Query the data from form it is displaying Numeric data in Arabic font, If run a report for same data it is display in Normal format[Arabic font is not displaying]. The below settings i had done 1. I

  • Skype Subscriptions offers not working. Help ASAP

    I'm a new customer whos trying to get the special offer of $4.99 for a skype premiun package but whenever I try to but the product is asking me for $8.99 a month. HELP 

  • Goods receipts with GTIN barcode thru RF

    Hello Experts, In order to perform Goods receipts with a custom RF transaction, we need to scan the material number and PO number on the pallet that is sent by vendors.these barcodes are external barcodes from the vendor. Our vendors are using GTIN c

  • How to get calling jsp name?

    We are implementing iStore 12.1.3 We have a jsp which can be called from multiple jsps. When the jsp is processed, navigation should go back to the calling jsp. Is there any in-built API which provides calling jsp name? Please advise urgently. Thanks

  • Can not install GNUsound. 'Make' not compiling.

    There last lines then I write 'configure' and 'make': checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking build system