IPv6 Formatting for JDBC and SQLPlus

Posted in: Oracle, Technical Track

Does IPv6 formatting for JDBC and SQLPlus seem new to you well, it’s been available since 11gR2.

You’re familiar with IPv6, right? If not, click here.

Basically, the only thing you need to do is enclose the IPv6 address in square brackets, like this:

Connect on IPV4:

SQL> connect user/pass@172.23.10.40:1521/PYTHIANDB

 Connected.

Connect on IPV6:

SQL> connect user/pass@[1:95e05a:g0d:da7a:2020]:1521/PYTHIANDB

 Connected.

JDBC (thin) IPV4:

url="jdbc:oracle:thin:@(DESCRIPTION=
(LOAD_BALANCE=on) (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=172.23.10.40) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=172.23.10.41)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=PYTHIANDB)))"

JDBC (OCI) IPV4:

url="jdbc:oracle:oci:@(DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP)(HOST=172.23.10.40)(PORT=1521)) 
(CONNECT_DATA=(SERVICE_NAME=PYTHIANDB)))"

JDBC (thin) IPV6:

url="jdbc:oracle:thin:@(DESCRIPTION=
(LOAD_BALANCE=on) (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=[1:95e05a:g0d:da7a:2020]) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=[1:95e05a:g0d:da7a:2021])(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=PYTHIANDB)))"

JDBC (OCI) IPV6:

url="jdbc:oracle:oci:@(DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP)(HOST=[1:95e05a:g0d:da7a:2020])(PORT=1521)) 
(CONNECT_DATA=(SERVICE_NAME=PYTHIANDB)))"

As you might suspect, the same thing applies to your TNSNAMES entries.

Also, according to this, you even use it for your LISTENER:

LISTENER =
 (DESCRIPTION_LIST =
  (DESCRIPTION =
   (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = [1:95e05a:g0d:da7a:2020])(PORT =1521))
  )
 )

Hope this helps!

email

Interested in working with Matheus? Schedule a tech call.

About the Author

Lead Database Consultant
Well known in the Oracle community in Latin America and Europe where he participates regularly in technology events, Matheus is actually the youngest Oracle ACE Director in the world. Lead Database Consultant at Pythian, Matheus is a Computer Scientist by PUCRS and has been working as an Oracle DBA for the last 10 years.

1 Comment. Leave new

Jared Still
May 5, 2020 2:36 pm

Cool, thanks for that Mattheus

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *