我不知道Java,但您可以从此问题中看到( Oracle正则表达式(REGEXP_LIKE)太长错误-ORA-12733 )如果IPv6地址格式正确,Java似乎是最容易完成的验证.我尝试使用正则表达式,虽然接近,但却是一场噩梦,而且对于PL/SQL来说,表达式太长了.
我在Oracle中使用Java进行工作.我只想验证格式,而不是地址确实存在.那么java.Inet6Address.getByName真的会出去看看地址是否存在吗?
文档说...( docs.oracle/javase/1.5.0/docs/api/java/net/InetAddress.html#getByName(java.lang.String))
"如果提供了原义IP地址,则仅检查地址格式的有效性."
我正在接受它,因为它无法ping通,我是否正确理解了?
解决方案这是正确的理解-它不会不发出 ICMP PING .
但是,必须出门"以解析主机名(通过 DNS ).
当然,当提供IP文字时,则不需要这样解析..仅当尝试进行名称解析确定/正常时,才使用此方法.通常使用它来检查IP文字的有效性时要小心.
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.Inet6Address.getByName literally go out and see if the address exists?
The documentation says... (docs.oracle/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?
解决方案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.
更多推荐
从字面上看java.net.Inet6Address.getByName是否会出去并查看地址是否存在
发布评论