checksum question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sea

    checksum question

    I understand that it is possible to test the integrity of data using
    something called checksum? What exactly is this and how do I use it in
    DB2? I've searched a lot of places but could not find an answer, hence
    this question -- thank you very much for any help!
  • Fan Ruo Xin

    #2
    Re: checksum question

    checksum used by db2 server, not by the user, to check the data (index, ...)
    page consistency. You can did some tests on Unix. Such as you have a testing
    db, you can use dd command to write some gabage data to one data page. Then
    you will meet checksum problem.

    "sea" <sea_099@hotmai l.com> wrote in message
    news:f8c6e337.0 402021148.47882 87b@posting.goo gle.com...[color=blue]
    > I understand that it is possible to test the integrity of data using
    > something called checksum? What exactly is this and how do I use it in
    > DB2? I've searched a lot of places but could not find an answer, hence
    > this question -- thank you very much for any help![/color]


    Comment

    • Blair Adamache

      #3
      Re: checksum question

      You can add a generated column in the row based on the contents of other
      rows (numeric values work better). Or, you can calculate functions
      across the tables using AVG, SUM, MAX and MIN, and store these values in
      other tables (or even in other database instances or on disk).

      Checksum algorithms themselves are not specific to relational database -
      they're very popular with barcodes. A search on checksum on google
      should give you some ideas on how to calculate checksums. Implementing
      one in DB2 is very simple with triggers or generated columns using
      numeric data. Character data would have to be transformed into something
      across which a mathematical function could be run (such as BIT data).

      sea wrote:
      [color=blue]
      > I understand that it is possible to test the integrity of data using
      > something called checksum? What exactly is this and how do I use it in
      > DB2? I've searched a lot of places but could not find an answer, hence
      > this question -- thank you very much for any help![/color]

      Comment

      • PM \(pm3iinc-nospam\)

        #4
        Re: checksum question


        Use www.google.com and search for
        modulus 10
        or
        luhn
        ex: http://utopia.knoware.nl/users/epreb...bers/Luhn.html

        This is just an example of a well know formula. (check digit)

        The basic principle is to apply a math function to the data and get a
        result.
        If you reapply the same function, you should get the same number again.
        (data considered the same/good/etc.)

        Those functions are developped by mathematicians so that the event of a wong
        positive is reduced.
        The function may be developped for a fixed length data stream or variable
        lenght...

        Of course you can also build your own but you may get sub-optimal/reduced
        validity checking.


        PM

        "sea" <sea_099@hotmai l.com> a écrit dans le message de
        news:f8c6e337.0 402021148.47882 87b@posting.goo gle.com...[color=blue]
        > I understand that it is possible to test the integrity of data using
        > something called checksum? What exactly is this and how do I use it in
        > DB2? I've searched a lot of places but could not find an answer, hence
        > this question -- thank you very much for any help![/color]


        Comment

        • Blair Adamache

          #5
          Re: checksum question

          Yes, checksums are used by DB2 internally at the physical (page) level
          to ensure data integrity. But nothing prevents the DBA from creating
          their own checksums at the logical level (row, column or table) to
          ensure that data integrity isn't damaged by an application error.

          Check constraints and NOT NULL are very basic ways of doing this (i.e.
          ensure every employee makes at least the minimum wage of $nn,nnnn per
          year or every employee is either male or female). I think Sea wants
          something more sophisticated - i.e. if the state in someone's address is
          Texas, the phone number and zipcode must be values that are possible in
          Texas.

          Fan Ruo Xin wrote:
          [color=blue]
          > checksum used by db2 server, not by the user, to check the data (index, ...)
          > page consistency. You can did some tests on Unix. Such as you have a testing
          > db, you can use dd command to write some gabage data to one data page. Then
          > you will meet checksum problem.
          >
          > "sea" <sea_099@hotmai l.com> wrote in message
          > news:f8c6e337.0 402021148.47882 87b@posting.goo gle.com...
          >[color=green]
          >>I understand that it is possible to test the integrity of data using
          >>something called checksum? What exactly is this and how do I use it in
          >>DB2? I've searched a lot of places but could not find an answer, hence
          >>this question -- thank you very much for any help![/color]
          >
          >
          >[/color]

          Comment

          • Mark A

            #6
            Re: checksum question

            "Blair Adamache" <badamache@2muc hspam.yahoo.com > wrote in message
            news:bvn795$dbt $1@hanover.toro lab.ibm.com...[color=blue]
            > You can add a generated column in the row based on the contents of other
            > rows (numeric values work better). Or, you can calculate functions
            > across the tables using AVG, SUM, MAX and MIN, and store these values in
            > other tables (or even in other database instances or on disk).
            >
            > Checksum algorithms themselves are not specific to relational database -
            > they're very popular with barcodes. A search on checksum on google
            > should give you some ideas on how to calculate checksums. Implementing
            > one in DB2 is very simple with triggers or generated columns using
            > numeric data. Character data would have to be transformed into something
            > across which a mathematical function could be run (such as BIT data).
            >[/color]
            Checksums are usually applied to an entire file to test the integrity of the
            file.

            A check digit is a digit added on the end of a number (customer number,
            invoice number, etc) that reduces the likelihood of transposition errors
            when copying the number. A check digit can eliminate 100% of single
            transposition errors and sometimes 100% of double transposition errors
            (depending on which modulus is used). A transposition error is defined as
            copying 54 when it should have been 45. Check digits always eliminate 90%
            of random errors (copying 47 when it should have been 45). Check digits have
            been used since long before barcodes came into existence.


            Comment

            • sea

              #7
              THANK YOU!!! Re: checksum question

              Thank you all so very much for all explanations and ideas about
              checksum, a subject I had no idea about to begin with! Thank you for
              your time and efforts!

              =============== =============== =============== =============== ============


              "PM \(pm3iinc-nospam\)" <PM(pm3iinc-nospam)@sympati co.ca> wrote in message news:<gaFTb.283 1$ZN1.211079@ne ws20.bellglobal .com>...[color=blue]
              > Use www.google.com and search for
              > modulus 10
              > or
              > luhn
              > ex: http://utopia.knoware.nl/users/epreb...bers/Luhn.html
              >
              > This is just an example of a well know formula. (check digit)
              >
              > The basic principle is to apply a math function to the data and get a
              > result.
              > If you reapply the same function, you should get the same number again.
              > (data considered the same/good/etc.)
              >
              > Those functions are developped by mathematicians so that the event of a wong
              > positive is reduced.
              > The function may be developped for a fixed length data stream or variable
              > lenght...
              >
              > Of course you can also build your own but you may get sub-optimal/reduced
              > validity checking.
              >
              >
              > PM
              >
              > "sea" <sea_099@hotmai l.com> a écrit dans le message de
              > news:f8c6e337.0 402021148.47882 87b@posting.goo gle.com...[color=green]
              > > I understand that it is possible to test the integrity of data using
              > > something called checksum? What exactly is this and how do I use it in
              > > DB2? I've searched a lot of places but could not find an answer, hence
              > > this question -- thank you very much for any help![/color][/color]

              Comment

              • Blair Adamache

                #8
                Re: THANK YOU!!! Re: checksum question

                There is a modulus function in DB2, called MOD. It could be used in a
                generated column to automatically produce a checkdigit as follows:

                CREATE TABLE employeex (name VARCHAR(10),
                salary dec(10,2),
                mod_sal generated always as (mod(int(salary ),7)))

                sea wrote:
                [color=blue]
                > Thank you all so very much for all explanations and ideas about
                > checksum, a subject I had no idea about to begin with! Thank you for
                > your time and efforts!
                >
                > =============== =============== =============== =============== ============
                >
                >
                > "PM \(pm3iinc-nospam\)" <PM(pm3iinc-nospam)@sympati co.ca> wrote in message news:<gaFTb.283 1$ZN1.211079@ne ws20.bellglobal .com>...
                >[color=green]
                >>Use www.google.com and search for
                >>modulus 10
                >>or
                >>luhn
                >>ex: http://utopia.knoware.nl/users/epreb...bers/Luhn.html
                >>
                >>This is just an example of a well know formula. (check digit)
                >>
                >>The basic principle is to apply a math function to the data and get a
                >>result.
                >>If you reapply the same function, you should get the same number again.
                >>(data considered the same/good/etc.)
                >>
                >>Those functions are developped by mathematicians so that the event of a wong
                >>positive is reduced.
                >>The function may be developped for a fixed length data stream or variable
                >>lenght...
                >>
                >>Of course you can also build your own but you may get sub-optimal/reduced
                >>validity checking.
                >>
                >>
                >>PM
                >>
                >>"sea" <sea_099@hotmai l.com> a écrit dans le message de
                >>news:f8c6e337 .0402021148.478 8287b@posting.g oogle.com...
                >>[color=darkred]
                >>>I understand that it is possible to test the integrity of data using
                >>>something called checksum? What exactly is this and how do I use it in
                >>>DB2? I've searched a lot of places but could not find an answer, hence
                >>>this question -- thank you very much for any help![/color][/color][/color]

                Comment

                Working...