When can I get the "java.net.SocketException: Permission denied:connect" message? And how can it be avoided?
Estimated Reading Time: 1 MinutesThe "java.net.SocketException: Permission denied: connect" exception message may happen when you are working in Application Server or with a client/server environment via VPN connection.
This message is returned because isCOBOL uses the IPv4 type of sockets and support for IPv6 sockets was added to Windows in Java 7 and above. So, when you attempt to connect to an IPv4 address, "behind the scenes" Java will use an IPv4-mapped IPv6 address.
If the VPN product doesn't support IPv6 sockets, you may get this exception.
For example, if you want to connect via thin-client and you use any of the following commands:
iscclient -hostname host -port port progname java com.iscobol.gui.client.Client -hostname host -port port prognameOr if you want to access the Veryant UDBC server started on the server machine and you run the command:
visql -cstring jdbc:veryant:udbc-server-ip:udbc-server-port:database -u userTo solve this problem you need to use the java property java.net.preferIPv4Stack=true, telling Java you want it to try to use Ipv4 when available.
Here are some examples:
iscclient -J-Djava.net.preferIPv4Stack=true -hostname 10.234.10.18 MAIN_PROGR java -Djava.net.preferIPv4Stack=true com.iscobol.gui.client.Client -hostname 10.234.10.18 MAIN_PROGR visql -J-Djava.net.preferIPv4Stack=true -cstring jdbc:veryant:10.234.10.18:6789:VERYSAMPLE -u admin