1

I don't know java but as you can see from this question (Oracle Regular Expression (REGEXP_LIKE) Too Long Error - ORA-12733) java seems to be the easiest to accomplish validating if an IPv6 address is formatted correctly. I tried regular expressions, came close, but was a nightmare, and the expression is too long for PL/SQL.

I have the java in Oracle way working. I only want to validate the format, not that the address really exists. So does java.net.Inet6Address.getByName literally go out and see if the address exists?

The documentation says... (http://docs.oracle.com/javase/1.5.0/docs/api/java/net/InetAddress.html#getByName(java.lang.String))

"If a literal IP address is supplied, only the validity of the address format is checked."

I'm taking that as it does NOT ping, am I understanding that correctly?

Community
  • 1
  • 1
gfrobenius
  • 3,987
  • 8
  • 34
  • 66

1 Answers1

1

That is a correct understanding - it does not issue an ICMP PING.

However, it must "Go Out" to resolve the host-name (via DNS).

Of course, when an IP literal supplied, then there is no need to resolve as such .. Use this method only if attempting a name resolve is OK/desired. Be wary when using it to generally check for the validity of an IP literal.

user2864740
  • 60,010
  • 15
  • 145
  • 220
  • That's what I'm trying to do, just check for a valid IPv6 format. `java.net.Inet6Address.getByName` seems to work great, all tests passed. What should I do to just test the format? Please don't say regexp :) been down that path: http://stackoverflow.com/questions/21631669/regular-expression-regex-for-ipv6-separate-from-ipv4 – gfrobenius Feb 21 '14 at 00:44
  • @gfrobenius It *will* work - but it *will* also "Go Out" when such an address is not IPv6. If that's OK with you, then that's OK. Anyway, consider asking a [new] question about how to check for an IPv6 address in a way that *is* compatible with your environment/restrictions. Note that the "ORA error" question linked is about an Oracle DB regular expression and not about a Java regular expression. I'd just use a regular expression (or some tested code that someone else wrote) *behind* a method and call it a day. – user2864740 Feb 21 '14 at 00:45