About read consistency

Dear Guys
i m getting confused in read consistent image of oracle
please clear a little
suppose if i fired a query that takes 20 min to retrieve data...now its in processing when a B user update some of the rows and fired commit in between..suppose after 5 mins when A fired query
Now please tel A after 20 mins would get the updated rows or same image as it was when started query means old rows data

user11221081 wrote:
Dear Guys
i m getting confused in read consistent image of oracle
please clear a little
suppose if i fired a query that takes 20 min to retrieve data...now its in processing when a B user update some of the rows and fired commit in between..suppose after 5 mins when A fired query
Now please tel A after 20 mins would get the updated rows or same image as it was when started query means old rows dataYou should tell us that what should happen? Always remember that the databases work following the ACID properties where C stands for consistency. This means, that you must not ever see what is called a dirty read . It means that there must not be the case that you should see two different set of results in a single fetch. If a situation happens like this, the database must ensure that your data must be able to show that image of the data which is consistent to the time from when your query started. This is why you need the read consistent image and your database must follow some way of transaction isloation level which in Oracle database is read committed . This means that never ever a reader won't worry about writer and writer won't worry about reader (the word is wait but I changed it to worry to make the point clear).
If this doesn't make the things clear to you, read the link that Srini has given to you already.
HTH
Aman....

Similar Messages

  • Need for Read Consistency

    Dear Members :
    [1] In later versions of Oracle (10g/11) the error "ora-01555 snapshot-too-old" almost never occurs - is this true ?
    [2] Why in the first place need for read-consistency, if that's misleading ?
    This is just to convince myself - although I never encountered.
    Thanks in advance.
    Atanu

    user11184124 wrote:
    Dear Members :
    [1] In later versions of Oracle (10g/11) the error "ora-01555 snapshot-too-old" almost never occurs - is this true ? The important word here is almost which comes along with many things. If you have a sufficiently sized Undo tablespace and a properly configured Undo Retention period, its possible that you won't hit the 1555 error any time soon but that doesn't mean its gone for good. Its very much there and can definitely hit you.
    [2] Why in the first place need for read-consistency, if that's misleading ?
    This is just to convince myself - although I never encountered.
    I have given a reply for this in the below thread which also asked the same question. Have a read,
    about read consistency
    HTH
    Aman....

  • About database nature of read consistency,

    Hi All,
    can anybody explain me what is consistent read, logical read and physical read?

    Hi,
    A consistent read is when a database must read a cloned block that has been recently changed. This is a core concept of Oracle database that allows data to be changed and read at the same time. A User must be able to read all relevant data to the transaction at the time it started.
    For instance, let's assume I start doing a full table scan of a large table by noon. Another user comes by at 12:05 and deletes a few records of the same table. Oracle preserves the before-image of the table by the time I started doing my full table scan so that I don't get some results from noon and some results from 12:05. This is called read consistency. A Consistent read is that a session does to achieve this through the UNDO tablespaces.
    Logical read is a read from memory. For example a row that has been recently read and is now stored in the database buffer cache. The second time a query wants that row, oracle will detect it's in the cache and won't fetch from the disk again. This is a logical read, also called a consistent get.
    A Physical read is when the database will fetch the required blocks from the disk.

  • Read consistency in query with pl/sql functions

    Not sure if this is a bug or feature, but a query containing a user-defined pl/sql function does not include tables accessed within the pl/sql function in the read consistent view of data, eg
    select myfunc from tableA
    myfunc is a stored function that queries tableB and returns a value
    If a change to tableB is committed in another session during fetch phase of select statement, then fetched rows reflect the changes. The database does not recognise tables accessed in the plsql function as being part of the query.
    This happens in 7.3.4 and 8.1.6. Don't have 9i so can't tell.
    Anyone know if this is a bug or feature?
    Aside: you can also drop the plsql function whilst the fetch is running. It will kill the fetch. No DDL lock taken on the plsql function whilst select is running! Seems wrong.

    I don't know Forms but I know SQL*Plus and Oracle database. Normally PL/SQL running on the database can only access files on the host where the database instance is running even if you start PL/SQL with a SQL*Plus connection from another host.
    PL/SQL runs only the database instance not on the client side even if you start the PL/SQL code from a remote connection with SQL*Plus.

  • Question about reading hex data

    Hello! I am a Labview Novice and having a problem about reading hex data.
    Basically I am having bytes from the serial port like this: "80100E0E0AB4F646F24A00911267087E032080057FFF "
    It is not encoded in ASCII. What I want to do is to convert the hex to an ASCII hex string.
    so that the string would become hex numbers in ASCII.
    I think the following might be a solution, but I have no idea what the subvi is in the solution.
    http://forums.ni.com/t5/LabVIEW/Hex-String-to-Ascii-Hex-String/m-p/886078/highlight/true#M400462
    Thanks in advance and I appreciate your kind help!
    Solved!
    Go to Solution.

    coolmatthew wrote:
    What I want to do is actually this.
    You are using way too much code for all this. All you need is a concatenate strings, replacing your entire loop and such. Same result.
    (see also)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    HEXTwiddler.png ‏4 KB

  • Read consistency with compound query

    Does read consistency work for the whole compound query or does it work only for every single query in the compound query ?
    I mean if I issue the following statement
    select * from TABLE
    union all
    select * from TABLE
    if in the mean time an update has taken place on the table by an other session and also a commit is it possible that the second part of the union query to see that update ?
    Thanks

    My real life problem is the following:
    I have a movements table and an online_stoc table, I keep the online_stoc table sincronized with the movements table using a trigger on the movements table.
    When I issue a statement
    select item, sum(qta_din), sum(qta_sta)
    from
    select item, sum(qta) qta_din, 0 qta_sta
    from movements
    group by item
    union all
    select item, 0 qta_din, qta qta_sta
    from online_stoc
    group by item
    having sum(qta_din) <> sum(qta_sta)
    it should not give anny rows back and I almost always see this correct result.
    But I experienced one time that this query gave back a line and after a checking I saw that during the query execution time there was an insert transaction on the table movements that commited during te query.
    So I don't understand how was it possible.
    Thanks

  • Problem due to read consistency...

    Hi,
    Pls hv look on given scenario...
    Two transactions updating the same row
    Session 2's update waits until Session 1's commit release the row lock.
    In Session 1
    SQL>select color from cust where id=500;
    color
    red
    SQL>update cust set color='blue' where id=500;
    In Session 2
    SQL> select color from cust where id=500;
    color
    red
    SQL>update cust set color=green where id=500;
    (Waiting...)
    In Session 1
    SQL> COMMIT;
    In Session 2
    SQL>select color from cust where id=500;
    color
    green
    SQL>COMMIT;
    Due to read consistency second user never knows that someone had changed color to 'blue'.
    We can use flags etc to trap this.
    Is there any way in Oracle to stop this logical inconsistency ....?

    > I can use select ...for update for the purpose. but there r few reasons for
    not using this...
    We use JAVA with Oracle.
    Not a valid reason. If the language is incapable, or the application server is incapable, then change it.
    You cannot blame the RDBMS for not working when the problem is solely with the language/app server. And you will have the exact same problem with any RDBMS as the lock-row-before-updating is a fundamental RDBMS rule for protecting data integrity and guarding against lost updates.
    > If Java program crashes then the lock not get automatically released from
    Oracle.
    I'm not sure that this is a valid statement. I deal with Java apps from JBoss against my databases and I've yet to see this problem.
    But for the moment, let us assume you are correct - what happens when the Java app crashes after the UPDATE and before the COMMIT? The exact same problem. So how do you solve this? You cannot simply just ignore those locks and pretend that the locks created by the SELECT FOR UPDATE is a problem.
    Also, why are your Java programs crashing so much? If it does not work, fix it or replace it.
    > Any idea ?
    You can use optimistic locking. This is not preferable. It results in a serious performance issue (and data concurrency issues) with any kind of higher volume OLTP system.
    But when dealing with stateless clients (typical 3 tier architecture using web browser clients), there is no choice but to use optimistic locking. E.g.
    SELECT c.* INTO :existing_row FROM cust WHERE id = :0
    .. processing..
    UPDATE cust
    SET colour = :new_colour
    WHERE custid = :0
    AND cust_col1 = :existing_row.cust.col1
    AND cust_col2 = :existing_row.cust.col2
    AND cust_coln = :existing_row.cust.coln
    In other words, the UPDATE checks that the row has not been changed since it was last "seen". If the UPDATE returns a 0 row result, it means that the row has changed. In which case the app needs to handle that exception somehow.

  • Asking about read voltage.vi

    i'am pretty confused about reading voltage.vi where i dont know where all numbers come. Can i use it directly for reading stauff or tachometer ? anw, what is board ID and channels ? is there any pictures for both ?
    sorry for silly questions noobs here...
    thx,
    Attachments:
    postind di thread labview.JPG ‏32 KB

    Hi bangbit,
    As Pnt pointed out, the VI for which you posted an image does not acquire any
    data.  Since you are interested in measuring voltage, I will assume that
    you have either an E Series or M Series device.  If I am wrong, please
    specify what hardware you have and what driver will you use with it (E Series
    devices can use either DAQmx or the Tradional DAQ drivers)?  
    I recommend starting with one of the shipping examples available in
    LabVIEW.  In LabVIEW, go to the help menu and select Find Examples. 
    From there, select Hardware Input and Output and depending on whether you are
    using DAQmx or Traditional DAQ, you can select the appropriate folder according
    to the driver you are using.  If you are using DAQmx, you may want to play
    with the DAQ Assistant VI to set up some standard tasks. 
    You can find the device name by opening up Measurement and Automation Explorer
    (a program that installs with the device drivers).  Your device with the
    device name will be listed there. 
    If you have general questions about how to program in LabVIEW, please refer to LabVIEW Introduction Course
    - Six Hours and Getting
    Started with NI-DAQmx: Main Page. 
    Best Regards
    Hani R.
    Applications Engineer
    National Instruments

  • About Read table

    Can any body explain about Read table and when it can use.

    Hi,
    When u want to read a record based on some condition then u can use READ.
    LOOP AT itab.
    READ TABLE itab WITH KEY matnr = itab-matnr.
    IF sy-subrc = 0.
    ENDIF.
    ENDLOOP.
    U can read only a single record.
    U can also use
    READ TABLE itab INDEX 1.
    Reward points if this is helpful.

  • A question about transaction consistency between multible target tables

    Dear community,
    My replication is ORACLE 11.2.3.7->ORACLE 11.2.3.7 both running on linux x64 and GG version is 11.2.3.0.
    I'm recovering from an error when trail file was moved away while dpump was writing to it.
    After moving the file back dpump abended with an error
    2013-12-17 11:45:06  ERROR   OGG-01031  There is a problem in network communication, a remote file problem, encryption keys for target and source do
    not match (if using ENCRYPT) or an unknown error. (Reply received is Expected 4 bytes, but got 0 bytes, in trail /u01/app/ggate/dirdat/RI002496, seqno 2496,
    reading record trailer token at RBA 12999993).
    I googled for It and found no suitable solution except for to try "alter extract <dpump>, entrollover".
    After rolling over trail file replicat as expected ended with
    REPLICAT START 1
    2013-12-17 17:56:03  WARNING OGG-01519  Waiting at EOF on input trail file /u01/app/ggate/dirdat/RI002496, which is not marked as complete;
    but succeeding trail file /u01/app/ggate/dirdat/RI002497 exists. If ALTER ETROLLOVER has been performed on source extract,
    ALTER EXTSEQNO must be performed on each corresponding downstream reader.
    So I've issued "alter replicat <repname>, extseqno 2497, extrba 0" but got the following error:
    REPLICAT START 2
    2013-12-17 18:02:48 WARNING OGG-00869 Aborting BATCHSQL transaction. Detected inconsistent result:
    executed 50 operations in batch, resulting in 47 affected rows.
    2013-12-17 18:02:48  WARNING OGG-01137  BATCHSQL suspended, continuing in normal mode.
    2013-12-17 18:02:48  WARNING OGG-01003  Repositioning to rba 1149 in seqno 2497.
    2013-12-17 18:02:48 WARNING OGG-01004 Aborted grouped transaction on 'M.CLIENT_REG', Database error
    1403 (OCI Error ORA-01403: no data found, SQL <UPDATE "M"."CLIENT_REG" SET "CLIENT_CODE" =
    :a1,"CORE_CODE" = :a2,"CP_CODE" = :a3,"IS_LOCKED" = :a4,"BUY_SUMMA" = :a5,"BUY_CHECK_CNT" =
    :a6,"BUY_CHECK_LIST_CNT" = :a7,"BUY_LAST_DATE" = :a8 WHERE "CODE" = :b0>).
    2013-12-17 18:02:48  WARNING OGG-01003  Repositioning to rba 1149 in seqno 2497.
    2013-12-17 18:02:48 WARNING OGG-01154 SQL error 1 mapping LS.CHECK to M.CHECK OCI Error ORA-00001:
    unique constraint (M.CHECK_PK) violated (status = 1). INSERT INTO "M"."CHECK"
    ("CODE","STATE","IDENT_TYPE","IDENT","CLIENT_REG_CODE","SHOP","BOX","NUM","KIND","KIND_ORDER","DAT","SUMMA","LIST_COUNT","RETURN_SELL_CHECK_CODE","RETURN_SELL_SHOP","RETURN_SELL_BOX","RETURN_SELL_NUM","RETURN_SELL_KIND","INSERTED","UPDATED","REMARKS")
    VALUES
    (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15,:a16,:a17,:a18,:a19,:a20).
    2013-12-17 18:02:48  WARNING OGG-01003  Repositioning to rba 1149 in seqno 2497.
    The report stated the following:
    Reading /u01/app/ggate/dirdat/RI002497, current RBA 1149, 0 records
    Report at 2013-12-17 18:02:48 (activity since 2013-12-17 18:02:46)
    From Table LS.MK_CHECK to LSGG.MK_CHECK:
           #                   inserts:         0
           #                   updates:         0
           #                   deletes:         0
           #                  discards:         1
    From Table LS.MK_CHECK to LSGG.TL_MK_CHECK:
           #                   inserts:         0
           #                   updates:         0
           #                   deletes:         0
           #                  discards:         1
    At that time I came to the conclusion that using etrollover was not a good idea Nevertheless I had to upload my data to perform consistency check.
    My mapping templates are set up as the following:
    LS.CHECK->M.CHECK
    LS.CHECK->M.TL_CHECK
    (such mapping is set up for every table that is replicated).
    TL_CHECK is a transaction log, as I name it,
    and this peculiar mapping is as the following:
    ignoreupdatebefores
    map LS.CHECK, target M.CHECK, nohandlecollisions;
    ignoreupdatebefores
    map LS.CHECK, target M.TL_CHECK ,colmap(USEDEFAULTS,
    FILESEQNO = @GETENV ("RECORD", "FILESEQNO"),
    FILERBA = @GETENV ("RECORD", "FILERBA"),
    COMMIT_TS = @GETENV( "GGHEADER", "COMMITTIMESTAMP" ),
    FILEOP = @GETENV ("GGHEADER","OPTYPE"), CSCN = @TOKEN("TKN-CSN"),
    RSID = @TOKEN("TKN-RSN"),
    OLD_CODE = before.CODE
    , OLD_STATE = before.STATE
    , OLD_IDENT_TYPE = before.IDENT_TYPE
    , OLD_IDENT = before.IDENT
    , OLD_CLIENT_REG_CODE = before.CLIENT_REG_CODE
    , OLD_SHOP = before.SHOP
    , OLD_BOX = before.BOX
    , OLD_NUM = before.NUM
    , OLD_NUM_VIRT = before.NUM_VIRT
    , OLD_KIND = before.KIND
    , OLD_KIND_ORDER = before.KIND_ORDER
    , OLD_DAT = before.DAT
    , OLD_SUMMA = before.SUMMA
    , OLD_LIST_COUNT = before.LIST_COUNT
    , OLD_RETURN_SELL_CHECK_CODE = before.RETURN_SELL_CHECK_CODE
    , OLD_RETURN_SELL_SHOP = before.RETURN_SELL_SHOP
    , OLD_RETURN_SELL_BOX = before.RETURN_SELL_BOX
    , OLD_RETURN_SELL_NUM = before.RETURN_SELL_NUM
    , OLD_RETURN_SELL_KIND = before.RETURN_SELL_KIND
    , OLD_INSERTED = before.INSERTED
    , OLD_UPDATED = before.UPDATED
    , OLD_REMARKS = before.REMARKS), nohandlecollisions, insertallrecords;
    As PK violation fired for CHECK, I've changed nohandlecollisions to handlecollisions for LS.CHECK->M.CHECK mapping and restarted an replicat.
    To my surprise it ended with the following error:
    REPLICAT START 3
    2013-12-17 18:05:55 WARNING OGG-00869 Aborting BATCHSQL transaction. Database error 1 (ORA-00001:
    unique constraint (M.CHECK_PK) violated).
    2013-12-17 18:05:55 WARNING OGG-01137 BATCHSQL suspended, continuing in normal mode.
    2013-12-17 18:05:55 WARNING OGG-01003 Repositioning to rba 1149 in seqno 2497.
    2013-12-17 18:05:55 WARNING OGG-00869 OCI Error ORA-00001: unique constraint (M.PK_TL_CHECK)
    violated (status = 1). INSERT INTO "M"."TL_CHECK"
    ("FILESEQNO","FILERBA","FILEOP","COMMIT_TS","CSCN","RSID","CODE","STATE","IDENT_TYPE","IDENT","CLIENT_REG_CODE","SHOP","BOX","NUM","KIND","KIND_ORDER","DAT","SUMMA","LIST_COUNT","RETURN_SELL_CHECK_CODE","RETURN_SELL_SHOP","RETURN_SELL_BOX","RETURN_SELL_NUM","RETURN_SELL_KIND","INSERTED","UPDATED","REMARKS")
    VALUES
    (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15,:a16,:a17,:a18,:a19,:a20,:a21,:a22,:a23,:a24,:a25,:a26).
    2013-12-17 18:05:55 WARNING OGG-01004 Aborted grouped transaction on 'M.TL_CHECK', Database error 1
    (OCI Error ORA-00001: unique constraint (M.PK_TL_CHECK) violated (status = 1). INSERT INTO
    "M"."TL_CHECK"
    ("FILESEQNO","FILERBA","FILEOP","COMMIT_TS","CSCN","RSID","CODE","STATE","IDENT_TYPE","IDENT","CLIENT_REG_CODE","SHOP","BOX","NUM","KIND","KIND_ORDER","DAT","SUMMA","LIST_COUNT","RETURN_SELL_CHECK_CODE","RETURN_SELL_SHOP","RETURN_SELL_BOX","RETURN_SELL_NUM","RETURN_SELL_KIND","INSERTED","UPDATED","REMARKS")
    VALUES
    (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15,:a16,:a17,:a18,:a19,:a20,:a21,:a22,:a23,:a24,:a25,:a26)).
    2013-12-17 18:05:55  WARNING OGG-01003  Repositioning to rba 1149 in seqno 2497.
    2013-12-17 18:05:55 WARNING OGG-01154 SQL error 1 mapping LS.CHECK to M.TL_CHECK OCI Error
    ORA-00001: unique constraint (M.PK_TL_CHECK) violated (status = 1). INSERT INTO "M"."TL_CHECK"
    ("FILESEQNO","FILERBA","FILEOP","COMMIT_TS","CSCN","RSID","CODE","STATE","IDENT_TYPE","IDENT","CLIENT_REG_CODE","SHOP","BOX","NUM","KIND","KIND_ORDER","DAT","SUMMA","LIST_COUNT","RETURN_SELL_CHECK_CODE","RETURN_SELL_SHOP","RETURN_SELL_BOX","RETURN_SELL_NUM","RETURN_SELL_KIND","INSERTED","UPDATED","REMARKS")
    VALUES
    (:a0,:a1,:a2,:a3,:a4,:a5,:a6,:a7,:a8,:a9,:a10,:a11,:a12,:a13,:a14,:a15,:a16,:a17,:a18,:a19,:a20,:a21,:a22,:a23,:a24,:a25,:a26).
    2013-12-17 18:05:55  WARNING OGG-01003  Repositioning to rba 1149 in seqno 2497.
    I've expected that batchsql will fail cause it does not support handlecollisions, but I really don't understand why any record was inserted into TL_CHECK and caused PK violation, cause I thought that GG guarantees transactional consistency and that any transaction that caused an error in _ANY_ of target tables will be rollbacked for _EVERY_ target table.
    TL_CHECK has PK set to (FILESEQNO, FILERBA), plus I have a special column that captures replication run number and it clearly states that a record causing PK violation was inserted during previous run (REPLICAT START 2).
    BTW report for the last shows
    Reading /u01/app/ggate/dirdat/RI002497, current RBA 1149, 1 records
    Report at 2013-12-17 18:05:55 (activity since 2013-12-17 18:05:54)
    From Table LS.MK_CHECK to LSGG.MK_CHECK:
           #                   inserts:         0
           #                   updates:         0
           #                   deletes:         0
           #                  discards:         1
    From Table LS.MK_CHECK to LSGG.TL_MK_CHECK:
           #                   inserts:         0
           #                   updates:         0
           #                   deletes:         0
           #                  discards:         1
    So somebody explain, how could that happen?

    Write the query of the existing table in the form of a function with PRAGMA AUTONOMOUS_TRANSACTION.
    examples here:
    http://www.morganslilbrary.org/library.html

  • A question about reading tomcat source code

    Hi, everyone!
    I just saw the tomcat source code, there is a method named "await" in StandardServer class. The comment of this method decribe that this method will wait util a proper shutdown command is received.
    I'm confused about it after read this method.
    In my opinion, this method create a server socket on port 8005 by default, and wait for "SHUTDOWN" string to only close the server socket which is listening on port 8005.
    But I think this method is supposed to close all the server sockets which are listenning for client's request and belong to this server when port 8005 received "SHUTDOWN" string.
    Thank you in advance.
    Edited by: Garrett.Li on Oct 17, 2007 9:18 AM

    about reading tomcat source code i cant get you man,

  • A problem about reading from serial port

    Hi,
       I just sent '0x03' from MCU to PC continuously, and then sent  '/n' as a stop character after every '0x03'. I use labview to read the data. The problem is when it get two '03' it get a '0', another two '03' and another a '0'. I don't know where is the '0' from?
      PS: Hyper terminal can display natrually.
       Thank you! 
    帖子被hengfo在08-08-2007 10:14 PM时编辑过了
    Attachments:
    serial read.vi ‏36 KB

    I think the problem may be the loop reading the serial port is running too fast.  There is no timing delay in the loop, so you are reading it as fast as you can, and probably faster than the device is sending data.  So sometimes the buffer is empty, and then the empty string gets converted to a numeric zero.  The way to know for sure is to put an indicator on the error wire coming out of the serial port read.  I bet you will see errors about the read buffer being empty.
    Put a wait timer in the loop to slow down the execution just slightly.  This is a good idea so that LV doesn't eat up all the CPU resources.  Look at the example for Basic Serial Write and Read.  You may want to have a loop ahead of the read that waits until there are a certain number of bytes at the port before it reads the serial port.  You may want to put a loop around the serial port that waits until a valid number is read in before it exits the loop and goes to the numeric conversion.
    Message Edited by Ravens Fan on 08-09-2007 08:50 AM

  • Question about Reader DRM activation

    Hi All
    I got a paper "FAQ ACS Discontinuation of Sales, November 30, 2004"
    I have a question about ACS.
    As I konw, ACS is discontinued effective November 30, 2004.
    and I read a section in paper below:
    Q. Will Adobe Reader and Acrobat users get support from Adobe for eBook issues?
    A. Support is not available for the free Adobe Reader, however, assistance for user activation is
    available until December 31, 2006.
    Does it mean Reader activation service will be stop until December 31, 2006?
    That's a big problem for our ebook service!!

    Adobe communicated in January to ACS customers that the DRM Activator service would remain operational until December 31, 2007, one year longer than previously announced.
    If you didn't receive this announcement, send your contact info (email and surface mail) to "[email protected]".
    You'll receive an autotmated reply that your email bounced but it will then be manually confirmed.

  • Question about read method of InputStream

    Hello everyone,
    I am using read method of InputStream to read a stream from a remote machine. The network connection is not very stable (for example, a wireless network whose the signal strength is relatively low). I am wondering if read method returns -1 (which indicates the end of the stream has been reached), and if I invoke read method again on the same stream, is it possible to read any more data?
    I think maybe I can read some more data even if read returns -1 in one time because the connection is not very stable. I am looking for your comments to my problem in my specific situation.
    regards,
    George

    Thanks Adeodatus,
    Doc says This method blocks until input data is
    available, the end of the stream is detected, or
    an
    exception is thrown.
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputS
    tream.html#read()
    I have not found any related parts in documents.
    http://java.sun.com/j2se/1.4.2/docs/api/
    Them's docs.
    if you're using a different version of java, replace
    the underlined portion with your version number.I am using JDK 1.3, and I have found related documents. But I can not find out where can I set timeout value of read operation. I am reading data from an HTTP InputStream. Can you help?
    regards,
    George

  • Question about reading a string or integer at the command line.

    Now I know java doesn't have something like scanf/readln buillt into it, but I was wondering what's the easiest, and what's the most robust way to add this functionality? (This may require two separate answers, sorry).
    The reason I ask is because I've been learning java via self study for the SCJA, and last night was the first time I ever attempted to do this and it was just hellish. I was trying to make a simple guessing game at the command line, I didn't realize there wasn't a command read keyboard input.
    After fighting with the code for an hour trying to figure it out, I finally got it to read the line via a buffered reader and InputStreamReader(System.in), and ran a try block that threw an exception. Then I just used parseInt to get the integer value for the guess.
    Another question: To take command line input, do you have to throw an exception? And is there an easier way to make this work? It seems awfully complicated to take user input without a jframe and calling swing.
    Edited by: JGannon on Nov 1, 2007 2:09 PM

    1. Does scanner still work in JDK1.6?Try it and see. (Hint: the 1.6 documentation for the class says "Since: 1.5")
    If you get behaviour that doesn't fit with what you expect it to do, post your code and a description of our expectations.
    2. Are scanner and console essentially the same thing?No.
    Scanner is a class that provides methods to break up its input into pieces and return them as strings and primitive values. The input can be a variety of things: File InputStream, String etc (see the Scanner constructor documentation). The emphasis is on the scanning methods, not the input source.
    Console, on the other hand, is for working with ... the console. What the "console" is (and whether it is anything) depends on the JVM. It doesn't provide a lot of functionality (although the "masked" password input can't be obtained easily any other way). In terms of your task it will provide a reader associated with the console from which you can create a BufferedReader and proceed as you are at the moment. The emphasis with this class is the particular input source (and output destination), not the scanning.
    http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
    http://java.sun.com/javase/6/docs/api/java/io/Console.html

Maybe you are looking for

  • Problem with hotspots in new version of DW v 2014.1

    How do I get the "hotspot" icons (circle, rectangle, polygonal icons) to show in the property bar. It wont show any of the hotspot icons and I also cant edit an old HTML file that has hotspots.  I can see the hotspots, but can't select them or edit t

  • BPAV files not picked up by XDCAM transfer

    Okay this is a strange one - I shall describe the steps as they happened. Hopefully somebody can help me. - Edited a vid sequence in FCP. - Tried to import more footage from XDCAM Transfer into FCP but got hard disk full notice. - I moved the source

  • Given up on MAIL

    I have tried everything suggested both by users and Apple but I can not get Mail to accept messages or send them and now can't even access the password. Is there any way I can get my I Mac to bring up my working e-mail which happens to be TDS, when u

  • Massive audio issues since Mavericks

    Hello there. Since switching to Mavericks my Motu Ultralite Mk3 has massive problems. I have very loud "Pop" sounds and interuptions. especialy if i don`t play audio for a few minutes, the first time i press play the speakers give the feeling they ar

  • Changing Font in Oracle Forms 9i PL/SQL Editor

    Hi, My fonts in PL/SQL Editor(Where we write code for triggers and Program Units) got changed some how and now the font is very very small and it is very difficult to read. i want to restore the original font !!! Please mail how i can change the font