Servlet cancel query event

Hi all,
I wrote a servlet which queries a database and returs the results to the calling client. Now I want to enable the client to cancel long-running queries. Is it possible to catch an event in the servlet e.g. if the client-user hits a "cancel" button?
Thank you!
Benni

I doubt it. Once the database gets the query, it begins processing it. I dont think anything in your server side JDBC will be sent to interrupt it. Even if it did, what is the user to do next? He can only retry the same query.
How about instead looking at your sql statement again and seeing if you can:
A: add a filter to the JSP page that allows the user to limit the returned amount of data. Example: If user enters 'B' in a textfield, then the sql becomes: "select * from person where lastName like '%B'.
Most users only want to see at most 30 or so rows returned, not 10000.
B: Optomize your sql statement - such as provide indexes on the database side. Also, only return those database table fields that the user needs, not all fields.

Similar Messages

  • How to cancel the event in Item Adding and display javascript message and prevent the page from redirecting to the SharePoint Error Page?

    How to cancel the event in Item Adding without going to the SharePoint Error Page?
    Prevent duplicate item in a SharePoint List
    The following Event Handler code will prevent users from creating duplicate value in "Title" field.
    ItemAdding Event Handler
    public override void ItemAdding(SPItemEventProperties properties)
    base.ItemAdding(properties);
    if (properties.ListTitle.Equals("My List"))
    try
    using(SPSite thisSite = new SPSite(properties.WebUrl))
    SPWeb thisWeb = thisSite.OpenWeb();
    SPList list = thisWeb.Lists[properties.ListId];
    SPQuery query = new SPQuery();
    query.Query = @"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + properties.AfterProperties["Title"] + "</Value></Eq></Where>";
    SPListItemCollection listItem = list.GetItems(query);
    if (listItem.Count > 0)
    properties.Cancel = true;
    properties.ErrorMessage = "Item with this Name already exists. Please create a unique Name.";
    catch (Exception ex)
    PortalLog.LogString("Error occured in event ItemAdding(SPItemEventProperties properties)() @ AAA.BBB.PreventDuplicateItem class. Exception Message:" + ex.Message.ToString());
    throw new SPException("An error occured while processing the My List Feature. Please contact your Portal Administrator");
    Feature.xml
    <?xml version="1.0" encoding="utf-8"?>
    <Feature Id="1c2100ca-bad5-41f5-9707-7bf4edc08383"
    Title="Prevents Duplicate Item"
    Description="Prevents duplicate Name in the "My List" List"
    Version="12.0.0.0"
    Hidden="FALSE"
    Scope="Web"
    DefaultResourceFile="core"
    xmlns="http://schemas.microsoft.com/sharepoint/">
    <ElementManifests>
    <ElementManifest Location="elements.xml"/>
    </ElementManifests>
    </Feature>
    Element.xml
    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Receivers ListTemplateId="100">
    <Receiver>
    <Name>AddingEventHandler</Name>
    <Type>ItemAdding</Type>
    <SequenceNumber>10000</SequenceNumber>
    <Assembly>AAA.BBB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8003cf0cbff32406</Assembly>
    <Class>AAA.BBB.PreventDuplicateItem</Class>
    <Data></Data>
    <Filter></Filter>
    </Receiver>
    </Receivers>
    </Elements>
    Below link explains adding the list events.
    http://www.dotnetspark.com/kb/1369-step-by-step-guide-to-list-events-handling.aspx
    Reference link:
    http://msdn.microsoft.com/en-us/library/ms437502(v=office.12).aspx
    http://msdn.microsoft.com/en-us/library/ff713710(v=office.12).aspx
    Amalaraja Fernando,
    SharePoint Architect
    Please Mark As Answer if my post solves your problem or Vote As Helpful if a post has been helpful for you. This post is provided "AS IS" with no warrenties and confers no rights.

    Recommended way for binding the list event handler to the list instance is through feature receivers.
    You need to create a feature file like the below sample
    <?xmlversion="1.0"encoding="utf-8"?>
    <Feature xmlns="http://schemas.microsoft.com/sharepoint/"
    Id="{20FF80BB-83D9-41bc-8FFA-E589067AF783}"
    Title="Installs MyFeatureReceiver"
    Description="Installs MyFeatureReceiver" Hidden="False" Version="1.0.0.0" Scope="Site"
    ReceiverClass="ClassLibrary1.MyFeatureReceiver"
    ReceiverAssembly="ClassLibrary1, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=6c5894e55cb0f391">
    </Feature>For registering/binding the list event handler to the list instance, use the below sample codeusing System;
    using Microsoft.SharePoint;
    namespace ClassLibrary1
        public class MyFeatureReceiver: SPFeatureReceiver
            public override void FeatureActivated(SPFeatureReceiverProperties properties)
                SPSite siteCollection = properties.Feature.Parent as SPSite;
                SPWeb site = siteCollection.AllWebs["Docs"];
                SPList list = site.Lists["MyList"];
                SPEventReceiverDefinition rd = list.EventReceivers.Add();
                rd.Name = "My Event Receiver";
                rd.Class = "ClassLibrary1.MyListEventReceiver1";
                rd.Assembly = "ClassLibrary1, Version=1.0.0.0, Culture=neutral,
                    PublicKeyToken=6c5894e55cb0f391";
                rd.Data = "My Event Receiver data";
                rd.Type = SPEventReceiverType.FieldAdding;
                rd.Update();
            public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
                SPSite sitecollection = properties.Feature.Parent as SPSite;
                SPWeb site = sitecollection.AllWebs["Docs"];
                SPList list = site.Lists["MyList"];
                foreach (SPEventReceiverDefinition rd in list.EventReceivers)
                    if (rd.Name == "My Event Receiver")
                        rd.Delete();
            public override void FeatureInstalled(SPFeatureReceiverProperties properties)
            public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
    }Reference link: http://msdn.microsoft.com/en-us/library/ff713710(v=office.12).aspxOther ways of registering the list event handlers to the List instance are through code, stsadm commands and content types.
    Amalaraja Fernando,
    SharePoint Architect
    Please Mark As Answer if my post solves your problem or Vote As Helpful if a post has been helpful for you. This post is provided "AS IS" with no warrenties and confers no rights.

  • Cancelled (detached) events showing on shared calendar - help!

    I can't figure out how to remove cancelled events from showing in iCal on a shared calendar. We use Zimbra for mail, etc. I subscribe to my boss' calendar and it is showing his cancelled (detached) events. They do not show in his iCal on his computer and they don't show in Zimbra. They only show in my iCal. I've looking in every preference I can find....I've tried un-subscribing to the calendar and then re-subscribing. Nothing seems to work. Any ideas??

    Consequently........it only seems to happen with recurring events we migrated from Microsoft Exchange. I cannot replicate it with a new appointment. I would still, however, like to be able to remove ones that are currently here. Since, they are recurring, they do show in the future, as well.

  • Why iCal cancel of event edits issue is still not fixed after over 2 years?

    Why iCal "cancel of event edits" issue is still not fixed after over 2 years?
    I have been in the software engineering industry for over 14 years, but I have never seen a large corporation being so slow at addressing major issues like these.
    What would it take for Apple to start working on this issue?

    Yup. This is fully ridiculous that you can't cancel your updates once you start. I love the tool but this is on pretty significant issue.
    Sometimes I accidentally move a mtg or make some edit while viewing and you can't back you!!
    If you feel the same way, you should post a note here:
    http://www.apple.com/feedback/ical.html
    Message was edited by: SteveMc10123

  • Is it possible to set the SYSTEM.MODE to 'NORMAL'?? How to do a CANCEL-QUERY??

    Hi All;
    I have a form in which i have created 'ENTER-QUERY', 'EXECUTE-QUERY', 'CLEAR', 'SAVE' & 'EXIT'.
    Now i want to create a 'CANCEL-QUERY', but i exactly don't know what code to put in so that it functions like 'CANCEL-QUERY' of DEFAULT&SMARTBAR.
    Can you please let me know??
    And also , actually i tried the following for 'CANCEL-QUERY' in WHEN-BUTTON-PRESSED trigger .
    BEGIN
      CLEAR_BLOCK(NO_VALIDATE);
      IF :SYSTEM.MODE = 'ENTER-QUERY'
      THEN SYSTEM.MODE := 'NORMAL';
      END IF;
    END;
    I got an error saying A READ-ONLY bind variable used in OUT or IN-OUT context.
    So i guess, i cannot alter or set the status of SYSTEM.MODE. Ofcourse i can't, How can I..
    So what do i put in the Code to do CANCEL_QUERY action??
    Thank You.
    Oracle Forms 6i.
    Oracle 9i.

    I'd just like to know did you manage to cancel a query using my code ,Please try..
    IF :SYSTEM.MODE = 'ENTER-QUERY'
      THEN
      EXIT_FORM(NO_VALIDATE);
    END IF;
    Hope it works..:)

  • Cancel Query not working

    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.

    jemar98 wrote:
    Problem Summary
    Cancel Query not working on 11.5.10
    Problem Description
    While finding orders, window pops up the cancel query but when user tries to click the cancel button, query does not cancel.Please post the details of the application release, database version and OS.
    Was this working before? If yes, any changes been done recently?
    Please review (Canceling Long Running Queries in Oracle Applications 11i [ID 138159.1]) and make sure you complete all the steps.
    Thanks,
    Hussein

  • Which trigger fires when i press cancel query button in oracle d2k forms.

    hi all,
    i have simply press then enter query but didn't enter anything in form and then press the cancel query. so i just want to know that what trigger will fire when i press the cancel query button in d2k form.
    Regards,
    kam.

    Why not ask into Forms<br>
    <br>
    Nicolas.

  • How to cancel query in Enter Query mode programmaticaly? [SOLVED]

    I'd like to put the button in the block and fire trigger to cancel query similar as in DEFAULT&SMARTBAR menu Cancel Query button. Is this possible at all?
    Thanks!
    m.
    Edited by: marussig on Dec 4, 2009 6:40 PM
    Edited by: marussig on Dec 10, 2009 10:17 PM
    Edited by: marussig on Dec 11, 2009 7:02 PM

    Hi,
    When I click icon enter query on Oracle DEFAULT&SMARTBAR menu and then click icon execute query on Oracle DEFAULT&SMARTBAR menu, everything is OK.
    But, if I put button, and trigger WHEN-BUTTON-PRESSED on it and command ENTER_QUERY in plsql code of this trigger, click the button and then click the second button to execute query with plsql command EXECUTE_QUERY - it doesn't work.
    So I have two buttons:
    1. button, WHEN-BUTTON-PRESSED trigger has command ENTER_QUERY
    2. button, WHEN-BUTTON-PRESSED trigger has command EXECUTE_QUERY (this second command doesn't work)
    Or: how can I programmatically execute command EXECUTE_QUERY when the block in is query mode?
    thanks
    m.

  • How to invoke a Servlet on onClick event of CheckBox ?

    Hi,
    Can anybody provide me with the code - how to invoke a Servlet & then pass all form variables to the Servlet on onClick Event of CheckBox in a JSP Page.
    I guess it is possible with Javascript but i need the code...
    Pls Help !
    Thanx.

    <html>
    <head>
    <script language="JavaScript">
    <!--
    function submitMyForm(){      
    document.myform.submit();
    //-->
    </script>
    </head>
    <body>
    <form name="myform" method="POST" action="http://mywebserver/servlet/myServlet" target=_top>
    <input type="checkbox" name="mycheckbox" OnClick = "javascript:submitMyForm()">
    </form>
    </body>
    </html>
    Hope this helps...

  • Cancel selection event in chart

    Hi all,
    Is it possible to cancel selection event on first bar in column chart when chart display at first time?
    Thanks,
    Ola

    This solution worked for me:  Visual Composer Tips and Tricks
    The tip applies to disabling the first select from a table, but it works for charts too.
    Hope that helps.
    Karen Waller

  • Delay time for Cancel query dialog

    Hi Folks.
    I have a form where the property Interaction Mode is set to NONBLOCKING.
    When a slow query is initiated, the cancel query dialog is displayed after approx. 5 secs.
    Can anyone tell me if it's possible to alter the delay time before this dialog is shown e.g., to 30 secs?
    Regards
    Carsten Nielsen

    super

  • SMARTBAR does not cancel query

    Hi again,
    I have the smartbar enabled and my form will call other modal canvases which inherit the main menu.
    I then tweak the functionality of my bar using the key triggers at block level. My form level triggers are all default.
    no global form key functionality other than key exit does exit form etc.
    All standard practice?
    When I enter query on my block with inherited menu cancel query will not work.
    I actually get the error message FRM-41009
    function key not allowed.
    CTRL q will not work either??
    It also means if my query returns no records I get stuck in enter query mode and have to bin the applet to exit.
    Please help me I am baffled!!
    Thanks in advance
    Oli

    Hi;
    Issue is not clear. Please review:
    Cancel Item Button Does Not Cancel Item On Purchase Order (PO) [ID 736772.1]
    You can also avaliable trace and see what happens
    Regard
    Helios

  • Cancel Query dialog does not show for long queries

    Hi,
    I've set the interaction mode of my form to non-blocking. I then ran a long query which takes about 5 minutes to display the results. The Cancel Query popup that everyone is talking about is still not showing.
    What should my settings be to make the Cancel Query dialog popup? My client wants to have the option to cancel a query while it is still processing.
    I'm using Oracle Forms 9.0.4.0.10 and Oracle Database 10g.
    Any help with regards to this will be highly appreciated.

    super

  • Canceling windowDeactivated event

    I'm writing a plug-in for ImageJ and operate on two images that are in seperate windows.
    The plug-in places pairs of markers on an image. I have implemented the WindowListener interface to capture the windowDeactivated event which checks if a marker pair is complete and if it's not asks the user if the placement should be cancelled.
    The event handler gets called as it should and I can display the dialog box and all but when a user wants to resume placing markers and not switch to the other window the event should be cancelled and focus reset on the original window.
    Resetting focus to the original window isn't that much of a problem but I can't cancel the event. After resetting focus the focus is then reset to the other window which I obviously don't want.
    I'm a little out of idea's since the consume method isn't available and I really don't know how to do this otherwise.

    Hi,
    I think your problem is the following: The event is only sort of a notification-event - this means it is not a signal that something will happen but a notification that something has happend (in your case the window lost the state of being the active window). So there is no need (it makes no sense) to cnacel or consume this event - this event is no reason for further system-actions like a key-event or a mouse-event.
    Your problem with re-gaining the focus has - in my opinion - the following reason: The system is at the moment when you get this event in the state that your window lost the focus (or the active-state) but the window which should gain the focus (from the point of view of the system) still hasn't got the focus. So after the actions of your listener are performed one of the systemactions will be to give the focus to the other window.
    That's the reason why setting the focus direct in your listener can't work. Normally it would help if you use the invokeLater-technique. This will guarantee that your work is done after(!) all the work the system has to do in this moment.
    HTH and greetings from
    Holger

  • Change attribute on cancel query

    Dear all,
    I have a block emp, its CURRENT_RECORD_ATTRIBUTE is set to NORMAL_ATTRIBUTE.
    I want to change the attribute to ENTER_QUERY_ATTRIBUTE when the user put the form into ENTER_QUERY mode,
    i did it from KEY-ENTQRY,
    If the user cancel the query, i want to change the current_record_attribute back to NORMAL_ATTRIBUTE.
    IS THERE ANY KEY TRIGGER EXIST FOR CANCEL QUERY?
    THANKS & REGARDS

    use the KEY-EXIT-trigger.
    Another option would be to use a WHEN-NEW-RECORD-INSTANCE-trigger and check SYSTEM.MODE

Maybe you are looking for

  • When I open lightroom I get an error message that says it needs to quit...???

    When I open Lighroom I immediately get an error message that pops up that says 'Lightroom encountered an error when reading from its preview cache and needs to quit. Lightroom will attempt to fix this problem the next time it launches.' When you clic

  • Using Flash Component

    Will Apple reject a Flash iPhone app that uses a Flash component? I want to create the app with a Flash plug-in component. Thanks.

  • JDBC drivers for SQL Server 2008 and NW 7.00 (UD connect)

    HI, we recently updated a UD connect Source DB fronm SQL Server 2000 to 2008; currently struggling to find a compatible JDBC driver; does anyone have a UD connect or PI system connected to a SQL 2008 DB via JDBC drivers?

  • Driver SDK: nextResults()

    Folks - I've been playing around a bit with the driver sdk (cooooooool stuff). How exactly is one meant to use the nextResults() method, anyway?  From what I can tell it indicates some sort of ability to retrieve multiple data providers -- is that tr

  • I'm having trouble with PFI 24..31 signals and can't program to higher drive

    Hi all, I'm having trouble setting up my PFI<24..31> signals on my PXIe-6556.  According to the specifications, I can drive these signals to +/-85mA.  I have not been able to achieve that using the static PFI method using NI-HSDIO.  I see the voltage