My Oracle Support Banner

Oracle JDBC Driver Does not use the IPV6 by Default (Doc ID 3049389.1)

Last updated on SEPTEMBER 27, 2024

Applies to:

JDBC - Version 21.10 and later
Information in this document applies to any platform.

Goal

A Linux OS is configured with a dual IP stack (IPv6/IPv4). It was observed that the Java applications connect to the database via IPv4 or IPv6, seemingly randomly. The expected behavior is that, as both sides client and server have IPv6, the connection will use IPv6 as the preferred protocol. 

The native OS tools (nc, curl, etc.) were checked to consistently use IPv6 when trying to connect to the database using the scan database host name. However, this doesn't seem to be the behavior for the Oracle JDBC driver.

Why doesn't the Oracle driver use IPv6 consistently when the connection string contains the scan hostname?

When the JDBC connection string is changed to use the IPv6 address directly as the following:

url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=[0000:f000:00a:0000:d1d2:1a2b:1e00:1a00])(PORT=<port>)))(CONNECT_DATA=(SERVICE_NAME=<service-name>)))

then all connections are successful using IPv6.

 

[0000:f000:00a:0000:d1d2:1a2b:1e00:1a00] is not e areal IPv6. It is just a placeholder for real numbers. 0's. 1's and 2's are used for demonstration only.

 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.