JDBC- can u execute a query while processing results

can you execute a query in the while loop of a different resultSet?
e.g.,...
line2= ("Select teamName, played, won, lost, draw, forfor, against, points from leaguetable where tourId = " + tourId);
query4 = stmt.executeQuery(line2);
while (query4.next())
teamName = query4.getString(1);
playedTemp = query4.getString(2);
played = Integer.parseInt(playedTemp);
wonTemp = query4.getString(3);
won = Integer.parseInt(wonTemp);
lostTemp = query4.getString(4);
lost = Integer.parseInt(lostTemp);
drawTemp = query4.getString(5);
draw = Integer.parseInt(drawTemp);
forforTemp = query4.getString(6);
forfor = Integer.parseInt(forforTemp);
againstTemp = query4.getString(7);
against = Integer.parseInt(againstTemp);
pointsTemp = query4.getString(8);
points = Integer.parseInt(pointsTemp);
for (int i=0; i<homeTeams.length; i++){
if(teamName.equals(homeTeams)){
homeTeamScoreInt = Integer.parseInt(homeTeamScore[i]);
awayTeamScoreInt = Integer.parseInt(awayTeamScore[i]);
if(homeTeamScoreInt > awayTeamScoreInt){
played = played + 1;
won = won + 1;
forfor = forfor + homeTeamScoreInt;
against = against + awayTeamScoreInt;
points = points + 3;
line3 = ("Update LEAGUETABLE set played = " + played + ", won = " + won + ", forfor = " + forfor + ", against = " + against +
", points = " + points + " where tourid = " + tourId + " AND teamName = '" + teamName+ "'");
stmt.executeUpdate(line3);
it only works once, it stops at the end of the while loop, i.e., it doesnt loop around the resultSet like it should.

do you mean for this part...
query4 = stmt.executeQuery(line2);
while (query4.next())
surely the data is stored in the resultSet ??
or do you mean this part...
stmt.executeUpdate(line3);

Similar Messages

  • While Rollup is goingon Can we execute the query

    Hello All
    We have a cube and aggregates built on this cube and daily in my Process chain we have step Rollup.
    Now while Rollup is goingon Can we execute the query which is builut on the same cube? Will the cube will be locked?
    Can we excute query while load is goingon to this cube?
    Regards
    Balji

    Hi Balaji,
    You can execute a query when the roll up is going on. The new data is available to the report only when the rollup is complete, but this will not create locks.
    Hope this helps...

  • Can we execute a query in resultset while loop

    can we execute a query in resultset while loop
    for ex:
    rs=st.executeQuery("SQL");
    while(rs.next())
    rs1=st.executequery("SQL1");
    while(rs1.next())
    }

    If you do this, you lose "rs". Create a second
    Statement object for the other query.This is right. We have done it many times, It is not the issue as long as you use different statement with in the body of the loop

  • Can we execute a query in resultset of while loop

    can we execute a query in resultset while loop
    for ex:
    rs=st.executeQuery("SQL");
    while(rs.next())
    rs1=st.executequery("SQL1");
    while(rs1.next())
    }

    yup no problem..if it doesn work declare the second one as st1

  • How can I execute a query from a BSP application?

    How can I execute a query from a BSP application?
    I´m trying to execute a Query from intranet. I´ve been looking for examples, but the templates I´ve found doesn´t help me.
    does anybody has an example?
    Thanks.

    Hi
    Have you designed the BSP application ?
    design it first with one page
    page will have layout and Event handlers
    Design the layout with the fields
    in the event handler there are events
    in the event On Initiailization or ON inputprocessing write the select query similar to what we write in routine ABAp and fetch the data into ITAB and that has to be passed to the Layout
    see the doc
    BSP
    To learn how to create Web applications with Business Server Pages, you can work through the simple tutorials that build on each other. You should be able to run through all of the steps described here in your own system.
    If you want to develop Web applications with BSPs, your system must meet the following requirements: Prerequisites for Creating Web Applications.
    The following tutorials are available:
    · First Tutorial: First Steps with Business Server Pages…
    · Second tutorial: A Small BSP Application and A Small BSP Application with HTMLB
    · Third tutorial: Our First Online Bookshop
    · Fourth tutorial: Further Developing the Bookshop
    · A small Tutorial is also available for your first steps with the Model View Controller design pattern.
    · For a more complex MVC tutorial based on the third tutorial, see: Our Little Online Bookshop Using MVC and HTMLB
    When creating BSP applications, note the browser dependencies described in Note 598860.
    steps:
    1) start the transaction RZ10.
    2) now u u have to select Profile name, so select the INSTANCE Profile from the list of options given with the Profile parameter list.U may find multiple instance profile in the list, so select the profile in which ur server name is given.
    3) u will also find three options in the same window.
    Administrator data, Basic Maintenance, and Extended Maintenance. So select the last one from that.
    4) Now click on change button.
    5) here u will find parameter icm/host_name_full, so now set it as FQDN.
    6) Now copy ur settings with new version number.
    7) Activate that version.
    8) And now please restart ur WAS.
    So this will set ur FQDN, and also don't forget to login using Admin User.
    Now u also check for following service are active in your ICF setting or not,( just start transaction code SICF)
    /default_host/sap/bc/bsp/sap
    /default_host/sap/bc/bsp/sap/system
    /default_host/sap/bc/bsp/sap/public/bc
    /def ault_host/sap/public/bc
    /default_host/sap/public/bc/ur
    /default_host/sap/public/bsp/sap/public
    /default_host/sap/public/bsp/sap/public/bc
    /defaul t_host/sap/public/bsp/sap/system
    /default_host/sap/public/bsp/sap/htmlb
    if not then activate all.
    check this link
    Read this weblog...
    /people/brian.mckellar/blog/2003/09/25/bsp-in-depth-fully-qualified-domain-names
    http://www.thespot4sap.com/articles/SAP_WAS_Creating_BSP_Apps.asp
    it consists of screen shots also
    Check it.
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/101c3a1cf1c54be10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e9/bb153aab4a0c0ee10000000a114084/frameset.htm
    Regards
    Anji

  • How Can I Execute Sql Query in Managed bean?

    Hi,
    I want to execute sql query in managedbean and get the query result. How can I do?
    Best wishes!

    You can do this by having current Database connection your application is using like this
    public static synchronized DBTransaction getDBTransaction(){
    FacesContext ctx = FacesContext.getCurrentInstance();
    ValueBinding vb = ctx.getApplication().createValueBinding("#{data}");
    BindingContext bc = (BindingContext)vb.getValue(ctx.getCurrentInstance());
    DataControl dc = bc.findDataControl("AppModuleDataControl");
    ApplicationModuleImpl am = ((ApplicationModuleImpl)(ApplicationModule)dc.getDataProvider());
    return am.getDBTransaction();
    and then user DBTransaction object to create Statement and PreparedStatement you can find those in java doc.

  • How can I execute a query using RSCRMBW_REPORT?

    Hi everybody,
    I have read the document:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3ba5e590-0201-0010-59b1-cab51fd245b7
    and found it is very intersting for my requirement.
    I copied the report,and modified it regarding our case.But during the second call,I get runtime error.
    I debugged the code, and found the error results from method GET_CUBETYPE() of class CL_RSCRMBW_BAPI.In this method,it tries to create a object which is TYPE REF TO cl_rsd_dta.
    CREATE OBJECT lr_dta
         EXPORTING
           i_infoprov    = g_s_status-infocube
    But g_s_status-infcube is null.
    I am not able to find where this 'infocube' component  in this g_s_status struction is filled,even I found,I don't know how I can give this infocube parameter from report which 2 FM are called.
    My code is following:
    parameters: p_repuid TYPE RSCRMSTATUS-REPORTUID
    DEFAULT 'Z_IC_01/Z_COMP_Q003'.
    parameters: p_split type BAPI6110DIM-DIM_NAM.
    data:name_query TYPE CHAR50,
         result_table LIKE RSCRMSTATUS-TABNAME,
         it_return LIKE BAPIRET2 OCCURS 2 WITH HEADER LINE,
         infocube TYPE CHAR30,
         compid TYPE CHAR30.
    AT SELECTION-SCREEN  ON VALUE-REQUEST FOR p_repuid.
    CALL FUNCTION 'RSZ_COMPONENT_TREE_GET'
        EXPORTING
          i_title    = 'Query auswählen'(031)
        IMPORTING
          E_INFOCUBE = infocube
          E_COMPID   = compid
        EXCEPTIONS
          OTHERS     = 1.
      IF sy-subrc GT 0.
      ENDIF.
    concatenate infocube '/' compid into p_repuid.
    START-OF-SELECTION.
    CALL FUNCTION 'RSCRMBW_REPORT'
    EXPORTING
    i_mode = 'OPEN'
    i_reportuid = p_repuid
    I_PACKSIZE = 10000
    I_EXECMODE = 'TABLE'
    I_EXTRACT = 'ZBWTEST'
    I_SPLIT = p_split
    I_CLEAREXTRACT = 'X'
    TABLES
    E_T_RETURN = it_return.
    CALL FUNCTION 'RSCRMBW_REPORT'
    EXPORTING
    i_mode = 'START'
    i_reportuid = p_repuid
    I_PACKSIZE = 10000
    I_EXECMODE = 'TABLE'
    I_CLEAREXTRACT = 'X'
    TABLES
    E_T_RETURN = it_return.
    So far this creation of report is only the 2nd step.But I am not sure how step 3 to step 6 should be done so that the report can be execute exactly.
    What should I do? Pleas help me!
    Thanks in advance
    Regards,
    Liying
    Message was edited by: Liying Wang
    Message was edited by: Liying Wang
    Message was edited by: Liying Wang

    Liying
    Were you able to get a solution to this problem? I am facing the same issue too. The g_s_status-infocube is showing blank.
    Regards
    Dilip

  • ADF how can i execute a query with parameters when the page renders

    hi
    i am using ADF web 11g
    i need to execute a query with parameters when the page renders
    thanks

    hello,
    I'm a fan of Java code, I really am.
    But when you use ADF, you decided to move to a more declarative environment.
    So why not do it declarative, the adf way?
    In your pagedef insert a action binding.
    This can be anything, a call to the application module, a call on the iterator(Like executeWithparams, etc.)
    Create an invokeAction in your pagedef and set the condition.
    This example refreshes(Action 2 is execute query) the data.
    First the method binding:
        <action IterBinding="PersoonIterator" id="Execute" InstanceName="LSAppModuleDataControl.Persoon"
                DataControl="LSAppModuleDataControl" RequiresUpdateModel="true" Action="2"/>And the invoke action
        <invokeAction Binds="Execute" id="refreshData"/>This always refreshes the data on page entry, but anything is possible, you can set condictions for the invokeAction.
    -Anton
    PS Yes I know that pagedefs become backing beans in the end and yes that is Java code, but if you wanna play the ADF way, the goal is the reduction of Java code and the increased performance of declarative programming.

  • Can we execute the Reporting while the data is loading into that ODS/Cube.

    Hi Friends,
          Can we execute the reports on particular ODS/InfoCube in the following cases
    1) When the data is loading into that ODS/Infocube.
    2) When we are Archiving the data from that ODS/Infocube
    Thanks & Regards,
    Shaliny. M

    Hi Shaliny,
    First of all you are in the wrong forum, in Business Intelligence Old Forum (Read Only Archive) you will find better support.
    In case you are loading data in an infocube you will be able to have report only until the request that has the icon ready for reporting filled. In case of an ODS object i don't think you will be able to have valid reporting since the ODS data firstly needs to be activated.
    Nevertheless please post your question in the above link.
    Kostas

  • Error executing a query with large result set

    Dear all,
    after executing a query which uses key figures with exception aggregation the BIA-server log (TrexIndexServerAlert_....trc) displays the following messages:
    2009-09-29 10:59:00.433 e QMediator    QueryMediator.cpp(00324) : 6952; Error executing physical plan: AttributeEngine: not enough memory.;in executor::Executor in cube: bwp_v_tl_c02
    2009-09-29 10:59:00.434 e SERVER_TRACE TRexApiSearch.cpp(05162) : IndexID: bwp_v_tl_c02, QueryMediator failed executing query, reason: Error executing physical plan: AttributeEngine: not enough memory.;in executor::Executor in cube: bwp_v_tl_c02
    --> Does anyone know what this message exactly means? - I fear that the BIA-Installation is running out of physical memory, but I appreciate any other opinion.
    - Package Wise Read (SAP Note 1157582) does not solve the problem as the error message is not: "AggregateCalculator returning out of memory with hash table size..."
    - To get an impression of the data amount I had a look at table RSDDSTAT_OLAP of a query with less amount of data:
       Selected rows      : 50.000.000 (Event 9011)
       Transferred rows :   4.800.000 (Event 9010)
    It is possible to calculate the number of cells retreived from one index by multiplying the number of records from table RSDDSTAT_OLAP by the number of key figures from the query. In my example it is only one key figure so 4.800.000 are passed to the analytical engine.
    --> Is there a possibility to find this figure in some kind of statistic table? This would be helpful for complex queries.
    I am looking forward to your replies,
    Best regards
    Bjoern

    Hi Björn,
    I recommend you to upgrade to rev 52 or 53. Rev. 49 is really stable but there are some bugs in it and if you use BW SP >= 17 you can use some features.
    Please refer to this thread , you shouldn't´t use more than 50% (the other 50% are for reporting) of your memory, therefor I have stolen this quote from Vitaliy:
    The idea is that data all together for all of your BIA Indexes does not consume more then 50% of total RAM of active blades (page memory cannot be counted!).
    The simpliest test is during a period when no one is using the accelerator, remove all indexes (including temporary) from main memory of the BWA, and then load all indexes for all InfoCubes into ain memory. Then check your RAM utilization.
    Regards,
    -Vitaliy
    Regards,
    Jens

  • FRM-40737  How can I execute a query in a post block ?

    Hi,
    I have two blocks based on the same table. Then it is not a 'real' master detail case. The first block contains two fields who are the values in the where clause of the second block. In which trigger or where do I place the EXECUTE-QUERY ? I can't place it in the post-block because post-block don't accept EXECUTE-QUERY and I dont want to use a timer because it bring me some troubles.
    Than'k you !

    I have two blocks based on the same table. Then it is not a 'real' master detail case. You can easily create a master-detail here, if your data model allows it. A table can have a foreign key relation to itself. E.g. emp.manager_id if the fk to emp.empno.

  • How can I ignore multiple clicks while processing the first one?

    Hi -
    I am writing my first Flex program so I'm sorry if this is a newbie question.
    I have some code which handles a click but takes a while to finish. What I want to do is proces steh first click but ignore any more clicks until the code has finished dealing with the first one.
    Can anyone tell me the standard way to do this?
    Here's a simplified example with a builtin delay. If I click on the button several times and then wait, the clicks are all processed in sequence and the test count slowly increases. What I want the code to do is ignore any clicks which teh user made during the two second delay but start handling new clicks after the delay has finished.
    Example Code...
    <<?xml version="1.0"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx">
       <fx:Script>
          <![CDATA[
    private var count:Number = 0;
    private function clickHandler():void {
       // Something which takes a while to complete...
       var timer:Date = new Date();
       while( (new Date()).valueOf() - timer.valueOf() <  2000 ) {
          var nop:int = 0;
       // Report result
       count++;
       output.text="Test Number "+count;  
    ]]>
       </fx:Script>
       <s:Panel title="Example">
          <s:VGroup left="10" right="10" top="10" bottom="10">
               <s:Label id="output" text=""/>
               <s:Button label="Click Me" click="clickHandler();"/>
          </s:VGroup>
       </s:Panel>
    </s:Application>
    Thanks
    - Jon

    Thanks for the response Pramod. I tried to disable and enable the button but it doesn't seem to have any effect at all. If I click the button several times, this code still processs the clicks one at a time over the next few seconds. I am sure I am making a simple mistake somewhere here...
    private function clickHandler():void {
       mybutton.enabled = false;
    ...slow stuff here
       mybutton.enabled = true;
    Full code...
    <?xml version="1.0"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"      xmlns:s="library://ns.adobe.com/flex/spark"      xmlns:mx="library://ns.adobe.com/flex/mx">   <fx:Script>      <![CDATA[ private var count:Number = 0;  private function clickHandler():void {   mybutton.enabled = false;    // Something which takes a while to complete...   var timer:Date = new Date();   while( (new Date()).valueOf() - timer.valueOf() <  2000 ) {      var nop:int = 0;   }     // Report result   count++;   output.text="Test Number "+count;       mybutton.enabled=true;}  ]]>   </fx:Script>     <s:Panel title="Example">      <s:VGroup left="10" right="10" top="10" bottom="10">         <s:Label id="output" text=""/>         <s:Button id="mybutton" label="Click Me" click="clickHandler();"/>      </s:VGroup>   </s:Panel>  </s:Application>                         

  • Can I execute a query against an already populated RowSet object?

    Hi,
    Is it possible to query an already retrieved RowSet object?
    Something like "search within results" feature that many search engine posses .
    Thank you in advance, Kostas

    There is no ready-made way to execute SQL queries against a ResultSet. Anyway, you shouldn't keep ResultSets open, you should convert them to collections of objects and close them.
    When you get the ResultSet, loop over it, create an object of a suitable class from each row, and store those objects in a LinkedList.
    When you need to search within the results, loop over the LinkedList and pick the objects you need.
    Alternatively, re-execute the SQL query with the additional WHERE clauses appended to the original query.

  • Master-detail form to execute a query while attempting to insert a record

    I have two block and the relationship between them is master and detail. I looking for help/idea about how to retrieve and display a record when the user enters an existing value in the system. Basically, the user is in the form to enter a new record. After entering few values in the master block, the form validates whether these values already exists, if exists, retrieve it and display the record so that the user can update it.
    Any suggestion how to provide this functionality ?????

    you maybe use the good example of checking duplicated records on this forum by one of the Kevins to pop up warning msg of duplicated record, then force user to stop inserting, then go search that record.

  • How can you execute a function while the mouse is over a button.

    I've got a movieclip I want to move across the screen on the x axis to the left or right depending on which button the user hovers their mouse over.
    I thought I could do this with the following:
    right_btn.addEventListener(MouseEvent.MOUSE_OVER, moveRight);
    left_btn.addEventListener(MouseEvent.MOUSE_OVER, moveLeft);
    function moveRight(e.MouseEvent):void
         sampleMovieclip_mc.x += 1;
    function moveLeft(e.MouseEvent):void
         sampleMovieclip_mc.x -= 1;
    But I find that it only moves it 1 pixel when the mouse first goes over the button and not continiously as it stays over it.  I tried using Event.ENTER_FRAME to call the moveRight and moveLeft functions, but it just keeps going and I'm not sure how to kill the function once they move the mouse off of the button.
    Any help would be greatly appreciated.
    Thanks.

    use removeEventListener() method. Here is one of the ways to deal with it:
    // move direction
    var xd:int = 1;
    // speed along x
    var xs:Number = 1;
    right_btn.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    right_btn.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
    left_btn.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    left_btn.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
    function onMouseOver(e:MouseEvent):void {
         xd = e.curretnTarget == right_btn ? 1 : -1;
         addEventListener(Event.ENTER_FRAME, onEnterFrame);
    function onMouseOut(e:MouseEvent):void {
         removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    function onEnterFrame(e:Event):void
         sampleMovieclip_mc.x += xd * xs;

Maybe you are looking for

  • How can I upload a file to a website from my iPhone 5?

    I have a copy of my résumé on my phone and want to apply for a job online. The website has an upload button but all that does is take me to my photos and using copy/paste removes all formatting.

  • Bootcamp no device drivers found (Windows 7 64-bit)

    Hello, I am desperately trying to install Windows 7 64-bit on my mid-2011 MacBook Pro, on a 100g partition made by Bootcamp. My Macbook is using the latest Mavericks update OSX. I am using a Windows 7 .iso trial downloaded from Microsoft DigitalRiver

  • EM_Park at VPM State after two line connect to E&M ports at Router 3660

    Hi Need your help about VOIP problem. Our customer using Cisco 3660 with 2 unit of NM-2V modules. Each of NM-2V modules connect to 2 E&M Modules. Each of E&M module connect to PABX NEC NEAC 7400 ICS. The problem is, if two E&M voice port connections

  • Erratic Behavior with 2.1

    When I attempt to create a new version of a raw image (NEF) in 2.1, either through cropping or color correcting, the screen often goes blank. When I go back to the browswer only mode, I can see the original image with a number on it, as though I have

  • IPod Touch boots in foreign language - why?

    Why does my presumably new iPod Touch 3rd gen 32 GB boot up in Danish? The first time it did this I thought I had inadvertently changed the language selection (although I couldn't understand how this could happen). I restored the factory settings via