ResultSet limit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pvinod
    New Member
    • Aug 2007
    • 9

    ResultSet limit

    Hi,

    This is vinod.

    i have tried to read a 10 lacks records with column count 14 from the database at a single time. But my application shows OUT OF MEMORY error.

    Any help?

    my id : <id removed per posting guidelines>

    Thanks,
    Vinod
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by pvinod
    Hi,

    This is vinod.

    i have tried to read a 10 lacks records with column count 14 from the database at a single time. But my application shows OUT OF MEMORY error.

    Any help?

    my id : <id removed as per posting guidelines>

    Thanks,
    Vinod
    How much is 'a 10 lacks'?

    kind regards,

    Jos

    Comment

    • pvinod
      New Member
      • Aug 2007
      • 9

      #3
      10,00,000


      Thanks,
      vinod

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by pvinod
        10,00,000


        Thanks,
        vinod
        So that's one million records with 14 columns each? It depends a bit on the length
        of the columns but I can see that you get an OutOfMemoryErro r ... there are a
        few -X flags that increase the JVM's heap size but I think that's just postponing
        the execution. What do you want to load that many records in memory at once?

        kind regards,

        Jos

        Comment

        • pvinod
          New Member
          • Aug 2007
          • 9

          #5
          Originally posted by JosAH
          So that's one million records with 14 columns each? It depends a bit on the length
          of the columns but I can see that you get an OutOfMemoryErro r ... there are a
          few -X flags that increase the JVM's heap size but I think that's just postponing
          the execution. What do you want to load that many records in memory at once?

          kind regards,

          Jos
          Thanks for ur response Jos.

          I need to import data from one database to another database. Please give me some way to avoid this Outof Memory error.

          Regards,
          Vinod

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by pvinod
            Thanks for ur response Jos.

            I need to import data from one database to another database. Please give me some way to avoid this Outof Memory error.

            Regards,
            Vinod
            You might try to specify the Statement.setFe tchSize() on your Statement

            kind regards,

            Jos

            Comment

            • pvinod
              New Member
              • Aug 2007
              • 9

              #7
              Originally posted by JosAH
              You might try to specify the Statement.setFe tchSize() on your Statement

              kind regards,

              Jos

              I have tried this setFetchSize() method. But I got error message(Invalid fetch size).


              Thanks,
              Vinod

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                Originally posted by pvinod
                I have tried this setFetchSize() method. But I got error message(Invalid fetch size).

                Thanks,
                Vinod
                So what happens if you experiment a bit with different fetch sizes?

                kind regards,

                Jos

                Comment

                • pvinod
                  New Member
                  • Aug 2007
                  • 9

                  #9
                  Originally posted by JosAH
                  So what happens if you experiment a bit with different fetch sizes?

                  kind regards,

                  Jos
                  Hi,
                  I got the following error.

                  rs.setFetchSize (50);

                  java.sql.SQLExc eption: Invalid Fetch Size


                  Thanks,
                  Vinod

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by pvinod
                    Hi,
                    I got the following error.

                    rs.setFetchSize (50);

                    java.sql.SQLExc eption: Invalid Fetch Size


                    Thanks,
                    Vinod
                    Can you show us a bit of relevant code please? What database are you using?

                    kind regards,

                    Jos

                    Comment

                    • praveen2gupta
                      New Member
                      • May 2007
                      • 200

                      #11
                      Hi
                      The ResultSet is having a limit of 1000 results. You can not access unlimited number of records from a singlr sql query. So you are getting errors

                      Comment

                      • JosAH
                        Recognized Expert MVP
                        • Mar 2007
                        • 11453

                        #12
                        Originally posted by praveen2gupta
                        The ResultSet is having a limit of 1000 results.
                        That all depends on the database vendor and its JDBC driver.

                        kind regards,

                        Jos

                        Comment

                        • pvinod
                          New Member
                          • Aug 2007
                          • 9

                          #13
                          Originally posted by JosAH
                          That all depends on the database vendor and its JDBC driver.

                          kind regards,

                          Jos

                          Hi,

                          I have tried to read 3,00,000 records. I was able to do this.

                          Please advise. Is any other way to perform this.

                          Thanks,
                          Vinod

                          Comment

                          • JosAH
                            Recognized Expert MVP
                            • Mar 2007
                            • 11453

                            #14
                            Originally posted by pvinod
                            Hi,

                            I have tried to read 3,00,000 records. I was able to do this.

                            Please advise. Is any other way to perform this.

                            Thanks,
                            Vinod
                            I don't know if you followed an other identical thread but my observations are:

                            1) users are not willing to scroll through so much data. They want it in reasonable
                            chunks through which they can navigate.
                            2) you can't collect that much database because of memory constraints.

                            So my tip is to 'page' through all the data. Depending on your database and its
                            SQL dialect you might check the 'offset/limit' statement parts or the 'numrows'
                            statement part or whatever your database supports.

                            A few buttons for navigational purposes and just a bit of data in the Session
                            object can do the rest. Don't try to retrieve and show all the data in one piece.

                            kind regards,

                            Jos

                            Comment

                            • pvinod
                              New Member
                              • Aug 2007
                              • 9

                              #15
                              Originally posted by JosAH
                              I don't know if you followed an other identical thread but my observations are:

                              1) users are not willing to scroll through so much data. They want it in reasonable
                              chunks through which they can navigate.
                              2) you can't collect that much database because of memory constraints.

                              So my tip is to 'page' through all the data. Depending on your database and its
                              SQL dialect you might check the 'offset/limit' statement parts or the 'numrows'
                              statement part or whatever your database supports.

                              A few buttons for navigational purposes and just a bit of data in the Session
                              object can do the rest. Don't try to retrieve and show all the data in one piece.

                              kind regards,

                              Jos

                              thanks Jos. Let me try

                              vinod

                              Comment

                              Working...