Retrieving records using Thread

I am a newbie in Java Servlet programming. I want to retrieve some records from my db2 database every 5 minutes and then display the result for viewing.
I have no idea where should I put my html tags. Assuming that my program only have 2 methods which are the doPost method and runningThread method, should I put the tags within the doPost method or inside the running thread?
Example or tutorial are good in term of understanding for a beginner.
Thanks in advanced for any help.

You don't need to use threads to do it. If it is just updated response that you need, you can achieve it by setting headers appropriately for autorefresh.
In your doPost method , call
response.setIntHeader("Refresh", 300) the browser re-requests the page after 300 seconds
Then you can pull the new data and display.
HTH

Similar Messages

  • Retrieving records using SQL Date Queries

    Hello,
    I am using Lab Windows CVI 8.5 and also SQL TOolkit for my project. I am using DBMapColumnToChar function for mapping Date to the database. And for retrieving records I am using SQL Query as follows:
    SELECT * FROM DBTable WHERE DATE_TABLE BETWEEN '%s' AND '%s'",cCurrentDate,cCurrentDate
    I have given a drop down for selecting dates.
    When I execute the query I am not getting the selected date values an instead I am getting some records for which the dates aren't selected...
    Quick help needed for this..Thanks in advance

    Depending on the database, the date/time structure can be completely different from the structure in CVI.  CVI uses the Windows format for time(), that is the number of seconds since 1900.  The tm struct can break this apart into a date and time structure that is usable.
    I am using MS Access for the databases and SQL toolkit.  I finally ended up replace the date field with an INT field format, and then store the CVI time (gotten with time()) as an INT value.
    Easy then to get a search range, store it a tm struct and then convert with mktime() to a calendar time to search with.
    Hope this helps.  The date/time thing is a never ending struggle.
    Regards, David E.

  • Null Pointer Exception while Retrieving Records using Java API

    Hi,
        I am using the Class RetrieveLimitedRecords, to retrieve he records from the main table.
    While using this class I am getting an error Null Pointer Exception, when there are no records matching the search criteriea.
    Could anybody tell me how to ignore this error.
    Thanks,
    Priya.

    Hi,
    Thanks for the reply.
        There is no any class which automatically handles, so we should handle exceptions individually.
    Thanks,
    Priya.

  • Queries to retrieve records (using Coldfusion) into arrays

    I have been reading about Coldfusion and Flex/Flash Builder integration, I am quite the beginner here. So far, I was able to follow the examples I found at Adobe's website. Those tutorials show how to bind the query results into forms. What I want to do is to run a query that will return multiple records, and I would like to store those records in an array. In other words I want to access each of the elements of each object by iterating
    Here is an example (I am only putting the relevant part of the code here) of what I could achieve with binding so far
                protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getEmployeeDataByRegionResult.token = salesTarget.getEmployeeDataByRegion(/*Enter value(s) for */ 'Central');
              <s:CallResponder id="getEmployeeDataByRegionResult"/>
        <mx:DataGrid x="477" y="118" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getEmployeeDataByRegionResult.lastResult}">
            <mx:columns>
                <mx:DataGridColumn headerText="PHONE" dataField="PHONE"/>
                <mx:DataGridColumn headerText="FIRSTNAME" dataField="FIRSTNAME"/>
                <mx:DataGridColumn headerText="YTD" dataField="YTD"/>
                <mx:DataGridColumn headerText="Q1GOAL" dataField="Q1GOAL"/>
                <mx:DataGridColumn headerText="EMAIL" dataField="EMAIL"/>
                <mx:DataGridColumn headerText="LASTNAME" dataField="LASTNAME"/>
            </mx:columns>
        </mx:DataGrid>
    So instead of this, I basically want to load the results into an array, so that I can iterate through the records as I want. A mysql query in php type of query is exactly what I am looking for. For example
    $result = mysql_query("SELECT id, name FROM mytable WHERE .... ");
    while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
        printf("ID: %s  Name: %s", $row[0], $row[1]); 
    Thank you

    hi,
    this thread may interest you
    http://forums.adobe.com/message/2834411#2834411
    David.

  • Retrive records using ODATA with SQL functions

    Hi,
    I want to use SQL functions (for instance replace function) while retrieving records using ODATA endpoint using javascript. Like this:
    parent.SDK.REST.retrieveMultipleRecords(
    "$select=AccountId,Name,Telephone1&$filter=" + "replace(Telephone1,'-','') eq '12345678'",
    function (accountresults) {
    errorHandler,
    function () {
    But this is ending up with 404 bad request. Is there any way to achieve the same using any other technique?
    blog: <a href="http://technologynotesforyou.wordpress.com">http://technologynotesforyou.wordpress.com</a> | skype: ali.net.pk

    ODATA only supports simple comparison operators, and startswith, endswith and substringof. There are 2 approaches you could use without modifying the data:
    Have a less selective filter in ODATA, then filter the rest of the data in javascript. In this example, you could use ODATA to find all records where the telephone1 field has each of '1', '2', '3' etc, then use javascript to do the replace comparison. It
    depends how many records you have as to whether this is practical
    Write a plugin on RetrieveMultiple that applies the functions you want. This is not necessarily simple, and you'd need to determine how you identify in the query that you want to use a function like replace
    Another option could be to use a plugin when data is saved to strip out the characters you don't want, and store the results in a different field that you could then query on
    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

  • How to create relationship between two records using MDM Java APIs

    Hi,
    I am trying to create relationship between two records using Java Apis. Please guide me in doing this.
    Regards,
    Niraj

    Hi Niraj,
    There is ModifyRelationshipsCommand:
    http://help.sap.com/javadocs/MDM/SP06/com/sap/mdm/data/commands/ModifyRelationshipsCommand.html
    Retrieve Relationship command:
    http://help.sap.com/javadocs/MDM/current/com/sap/mdm/schema/commands/GetRelationshipListCommand.html
    Also, please refer similar thread, MDM Java API and relationships.
    Hope it helps..
    Regards,
    Mandeep Saini

  • How to use Thread.sleep() with Java Berkeley Base API?

    Hi,
    I have explained the weird problem about the server was too busy to response to SSH but it continued to finish to run (Server not response when inserting millions of records using Java Base API
    Even I tried to increase CachSize and renice Java program, but it did not work. So, I am thinking to set sleeping time for threads in Java Berkeley Base API (using “ps” command, there were 18 light weight processes created). My program did not implement transaction or concurrency because it simply creates (millions) databases records only. Is it possible and correct to do like this in the code:
    try{
    //do create a db record
    Thread.currentThread().sleep(1000);//sleep for 1000 ms
    catch(ItrerruptedException ie){
    Thank you for your kindly suggestion.
    Nattiya

    where can I get the help doc about use AT commands in java.
    Can you give me some code example about this. It is
    difficulty to me to write it myself.You simply have to send the characters and receive the characters via the comm extension. Here is the ITU standard command set - http://ridge.trideja.com/wireless/atcommands/v250.pdf. Various modems and other devices extend this in a number of ways, you may need to find documentation specific to your device as well. But start with the standard.

  • Retrieving record from oracle DB very slow..pls help

    Hi, i'm writing a VB code to retrieving records from Oracle DB Server version 8. I'm using VB Adodb to retrieve the records from various tables. Unfortunately one of the table are very slow to response, the table only contain around 204900 records. The SQL Statement to retrieve the records is a simple SQL Statement that contain WHERE clause only. Any issue that will make the retrieving time become slow? Is that a Indexing? Oracle Driver? Hardware Spec? Or any solution for me to improve the performance. Thanks!

    Well, there are a few things to consider...
    First, can you try executing your query via SQL*Plus? If there are database tuning problems, your query will be slow no matter where you run it.
    Second, are you retrieving significantly more rows in this query than in your other queries? It can take a significant amount of time to retrieve records to the client, even if it's quick to select them.
    Justin

  • C# retrieving records

    I am trying to retrieve records from a table using the code below, but I always get no records even though I know there are records in the table because I am checking with SQL+
    Can anyone help please ?
    try
                             using(OleDbConnection conn_oracle = new OleDbConnection(source))
                                  conn_oracle.Open();
                                  // store subsystem and update Lane statics
                                  string select = "SELECT * FROM pvdba.Subsystem";                               
                                  OleDbCommand cmd = new OleDbCommand(select, conn_oracle);
                                  OleDbDataReader reader = cmd.ExecuteReader();
                                  while(reader.Read())
                                       if(reader.IsDBNull(0) == false)
                                            m_nSubSystem = (int)reader[0];
                                       if(reader.IsDBNull(3) == false)
                                            Lane.s_sFilePath = (string)reader[3];
                                       if(reader.IsDBNull(4) == false)
                                            Lane.s_sSanderson = (string)reader[4];
                                       else
                                            Lane.s_sSanderson = ""; // SOO 1/9/2003 1.0.0.9
                                       if(reader.IsDBNull(5) == false)
                                            Lane.s_sOasis = (string)reader[5];
                                       else
                                            Lane.s_sOasis = ""; // SOO 1/9/2003 1.0.0.9
                                       if(reader.IsDBNull(6) == false)
                                            Lane.s_sOverViewPath = (string)reader[6];
                                       if(reader.IsDBNull(2) == false)
                                            m_sSubSystemName = (string)reader[2];
                                       //     Lane.TheMainForm = this;
                                  reader.Close();

    Please post your questions at forum for OLEDB for Oracle:
    Oracle Provider for OLE DB
    Regards
    Jagriti

  • Unable to retrieve records with search criteria

    Hi All,
    I am trying to retrieve records based on search criteria as below, but not able to retrieve records.
    I created a search Search s=new Search(repSchema.getTableId("Customers"));
    Search s=new Search(repSchema.getTableId("Customers"));
              SearchGroup sg = new SearchGroup();
    FieldSearchDimension fsdCustFinValidated = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated")));
    BooleanSearchConstraint bSearchComm_Validated = new BooleanSearchConstraint(false);
    s.addSearchItem(fsdCustFinValidated, bSearchComm_Validated);
    s.setComparisonOperator(Search.AND_OPERATOR);     
    FieldSearchDimension fsdMaintableType = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Company_Type")));
    TextSearchConstraint tscCustType = new TextSearchConstraint("CUSTOMER", TextSearchConstraint.EQUALS);
    s.addSearchItem(fsdMaintableType, tscCustType);
    s.setComparisonOperator(Search.AND_OPERATOR);
    Calendar calCreate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    calCreate.add(Calendar.DATE,-6);
    System.out.println("customerCreditEscalation: calCreate:" + calCreate.getTime());
    FieldSearchDimension fsdMaintableDate = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated_Trigger")));
    SearchConstraint srchConstCreateGE = new DateTimeSearchConstraint(calCreate,DateTimeSearchConstraint.LESS_THAN_OR_EQUAL_TO);
    sg.addSearchItem(fsdMaintableDate,srchConstCreateGE) ;
    sg.setComparisonOperator(Search.AND_OPERATOR);
    Calendar calCreate1 = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    calCreate1.add(Calendar.DATE,-7);
    SearchConstraint srchConstFinVldTrgrDate = new DateTimeSearchConstraint(calCreate1,DateTimeSearchConstraint.GREATER_THAN_OR_EQUAL_TO);
    sg.addSearchItem(fsdMaintableDate, srchConstFinVldTrgrDate);
    s.addSearchItem(sg);
    Basically I am trying to search using A=a and B=b and (C=c and D=d) where (C=c and D=d) is the search group.
    Please let me know if I am doing anything wrong.
    Thanks
    -Sai

    Hi Greg,
    Thanks for the answer. I am trying to do a search as below.
    Earlier in the blog I mentoned A=a and B=b and (C=c and D=d) where (C=c and D=d) is the search group, but my search is
    A=a and B=b and (C=c and C=d) . C is the same dimension, which is a timestamp field.
    I am getting my results with A=a and B=b and C< c where C is Timestamp field. But my requirment is equal to a date older than two days. So when I try equal A=a and B=b and C=c  it is not working(may be because it is timestamp field and c is a calendar ). So I am trying to do A=a and B=b and (C<c and C>d) so that I get records that fall with in those days. So for (C<c and C>d) I am creating a search group and adding it to search which is not giving me the rows.
    Hope I explained it ok.
    If you know of any samples please let me know.
    Regards
    -Sai

  • Retrieve Records By RemoteKey in Java API

    Hi All,
          I want to retrieve records by RemoteKey for that i found a class RetrieveRecordIdsByRemoteKeyCommand in Java API documentation but I am not able to use that because I am not able to create instance of KeyMapping class as it is a interface.
          Any one has done this before? can you please help me how to new keyMapping in java code to set to this class.
    Thanks
    Ninad

    Hi.
    at first if u want to know what is it RemoteSystemId get RemoteSystemProperties[] with GetRemoteSystemListCommand and after that call .getId().getIdValue() - that method return int it is really id of remote system in MDM u can check it in DB in table A2I_CM_AGENCIES of your repository schema(column ID ).
    So.. let's go forward there is some sample code which search records by remotekeys:
                TableId tbl=mdmGate.getRepSchema().getTable(tblCode).getId();
                ResultDefinition rd=new ResultDefinition(tbl);
                KeyMapping km=KeyMappingFactory.createKeyMapping(new RemoteSystemId(idSys));
                km.addKey(id);
                RetrieveRecordsByRemoteKeyCommand rrBYrk=new RetrieveRecordsByRemoteKeyCommand(mdmGate.getPool());
                rrBYrk.setRemoteKeys(km);
                rrBYrk.setResultDefinition(rd);
                rrBYrk.setSession(mdmGate.getUserSessionId());
                try {
                    rrBYrk.execute();
                } catch (CommandException ex) {
                    ex.printStackTrace();
                    return -1;
    I hope this help u

  • Get username from session and retrieve records from database wit tat userna

    hello..
    i got a ChangePassword.jsp which i retrieve the username from session using bean to display on e page..
    <jsp:getProperty name="UsernamePassword" property = "username"/>
    but in my servlet, i wan to retrieve records from database with tat username..
    i tot of coding
    String username = (String)request.getSession().getAttribute("UsernamePassword");
    and then use tat username to retrieve records.. but is that e right way? The page did not display and i got a CastingException..
    Please help.

    If you are using the session inside a jsp, you can say "session" without having to declare it.String usernamePassword = (String) session.getAttribute("usernamePassword");However, right after you get this value, check if it is null:
    if(usernamePassword==null)
    // do sth like forward to error page
    else
    // continue processing
    If it is null, then you are probably not setting it right in the first place. Make sure that in your servlet A you create a session, and before you return or forward to a jsp, that you actually set this value in the session like saying
    session.setAttribute("usernamePassword", usernamePassword);
    and it is case sensitive for the key.

  • I was trying to make a new screen recording using quicktimeplay, but when I watched the video after recording it all I could hear was me talking while the video was showing on the screen. How do I turn off that recording and turn the right one on? thanks

    I was trying to make a new screen recording using quicktimeplay, but when I watched the video after recording it all I could hear was me talking while the video was showing on the screen. How do I turn off that recording and turn the right one on? thanks

    Hi j2399123,
    It sounds like your screen recording is doing what it was designed to do, capture what is happening on your screen, with optional voice over with the microphone.
    Screen recording is for recording what you see on the screen, it is not a "video capture" option, like for capturing a movie with sound that is playing on your screen.
    For the QuickTime recording options, check out "Recording with QuickTime Player" in
    Mac Basics: QuickTime Player creates, plays, edits, and shares video and audio files
    http://support.apple.com/kb/ht4024
    And for screen recording specifically, there's
    QuickTime Player 10.x: Record your computer’s screen
    http://support.apple.com/kb/PH5882
    Thank you for thinking of Apple Support Communities for your support needs.
    Nubz

  • Change Scheduling Agreement and Info Record using Bapi

    Hi Experts,
    Can anybody say how to change the Scheduling agreement and Info Record using Bapi.
    I use BAPI_AGREEMENT_MAINTAIN to change Scheduling Agreement .
    But it does not changing Scheduling lines.

    Hi,
    Please find the below link check the setting are correct or not
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a02cb00a-bfb4-2c10-98aa-e33e7f64ba28?quicklink=index&overridelayout=true
    Reagrds,
    Pramod

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

Maybe you are looking for