Topic
6 replies Latest Post - ‏2013-01-15T07:44:37Z by SystemAdmin
SystemAdmin
SystemAdmin
17917 Posts
ACCEPTED ANSWER

Pinned topic DB2 have any equivalent mysql inet_aton, inet_ntoa functions?

‏2013-01-14T01:49:10Z |
Hi All,

I'll like to ask if DB2 have any in-built functions equivalent to mysql inet_aton, inet_ntoa?

Or is there any equivalent for ip2long or long2ip?

Thanks.
Updated on 2013-01-15T07:44:37Z at 2013-01-15T07:44:37Z by SystemAdmin
  • KayKanekowski
    KayKanekowski
    16 Posts
    ACCEPTED ANSWER

    Re: DB2 have any equivalent mysql inet_aton, inet_ntoa functions?

    ‏2013-01-14T06:34:44Z  in response to SystemAdmin
    Hi Julep,
    it may help us if you tell us what these functions are doing.

    regards
    Kay
  • SystemAdmin
    SystemAdmin
    17917 Posts
    ACCEPTED ANSWER

    Re: DB2 have any equivalent mysql inet_aton, inet_ntoa functions?

    ‏2013-01-14T07:49:20Z  in response to SystemAdmin
    Hi,

    I am considering storing ip address as numbers instead of varchar into DB2.
    Based on mysql functions inet_aton, inet_nota:

    mysql> SELECT INET_NTOA(167773449);
    -> '10.0.5.9'

    mysql> SELECT INET_ATON('10.0.5.9');
    -> 167773449

    Does DB2 have similar in-built functions as above?

    Thanks.
    • SystemAdmin
      SystemAdmin
      17917 Posts
      ACCEPTED ANSWER

      Re: DB2 have any equivalent mysql inet_aton, inet_ntoa functions?

      ‏2013-01-14T13:11:36Z  in response to SystemAdmin
      I have created a sample implementation for these functions in DB2 in my blog.
      Please check and let me know if it's what you are looking for.

      http://oradb2.blogspot.com/2013/01/db2-implementation-of-inetntoa-mysql.html
      http://oradb2.blogspot.com/2013/01/db2-implementation-of-inetntoa-mysql.html
      • SystemAdmin
        SystemAdmin
        17917 Posts
        ACCEPTED ANSWER

        Re: DB2 have any equivalent mysql inet_aton, inet_ntoa functions?

        ‏2013-01-14T13:12:34Z  in response to SystemAdmin
        Sorry, the second one is http://oradb2.blogspot.com/2013/01/db2-implementation-of-inetaton-mysql.html
  • SystemAdmin
    SystemAdmin
    17917 Posts
    ACCEPTED ANSWER

    Re: DB2 have any equivalent mysql inet_aton, inet_ntoa functions?

    ‏2013-01-15T06:00:21Z  in response to SystemAdmin
    Thanks AnasMosaad. Is there any also for IPv6?
    I presume there is no similar built-in functions in DB2 like what mysql have.

    Thanks. :)
    • SystemAdmin
      SystemAdmin
      17917 Posts
      ACCEPTED ANSWER

      Re: DB2 have any equivalent mysql inet_aton, inet_ntoa functions?

      ‏2013-01-15T07:44:37Z  in response to SystemAdmin
      Currently I don't have it, but you may post a sample output -like that for IPv4 above- to see if I can help.