Connecting to MySQL Server Using an IPV6 Address

- - posted in Technical | Tagged as ipv6,mysql | Comments

If you are one of those who does not know that there is a new way to connect to MySQL database with an IPV6 IP address, then keep reading. We will see how to connect to a mysql database on a server with an IPv6 address.

I struggled for this, so I wanted to document it. Source: Wiki IPv6

Address Format

IPv6 addresses have two logical parts: a 64-bit network prefix, and a 64-bit host address part.

(The host address is often automatically generated from the interface MAC address.) An IPv6 address is represented by 8 groups of 16-bit hexadecimal values separated by colons (:) shown as follows:

A typical example of an IPv6 address is:

2001:0db8:85a3:0000:0000:8a2e:0370:7334.

The hexadecimal digits are case-insensitive.

Method to connect to MYSQL using an IPv4 address (traditional way)

1
2
3
4
urlString = “jdbc:mysql://10.144.1.216:3306/dbName”;
Class.forName(driver);
DriverManager.setLoginTimeout(getConnectionTimeOut());
dbConnection = DriverManager.getConnection(urlString,user,password);

Method to connect to MYSQL using an IPv6 address (New way)

1
2
3
4
urlString = “jdbc:mysql://address=(protocol=tcp)(host=fe80::5ed6:baff:fe14:a23e)(port=3306)/db”;
Class.forName(driver);
DriverManager.setLoginTimeout(getConnectionTimeOut());
dbConnection = DriverManager.getConnection(urlString,user,password);

This new approach is no where documented over the internet, and a bug has been filed by Mark Mathews to include this as documentation in next release of MYSQL JDBC connector. Thanks to Mark for Pointing this out to us.

Check bugs at:
1. http://bugs.mysql.com/bug.php?id=59451
2. http://bugs.mysql.com/bug.php?id=8836

For those who wants to know more about Ipv6:
1. ipv6.com
2. IPv6-Beginners_Look.htm
3. Top-10-Features-that-make-IPv6-greater-than-IPv4.htm





Gravatar of Ashwani Kumar

Recent posts


Subscribe



Your Feedback encourages me




Learning and Developments

One Month Rails



, AWS AWS, Active Directory, Facebook Flash, Forwarding, GOD,Chat,Coffee Github,Feedback,Repo Google,Search HAProxy, IOT, IP-block JQuery Load MQ MQTT, Messaging Octopress Octopress, OpenVpn PI, Plugin Plugin, Port Raspberry, S3, SSH, Shell,Commands Soapui, Tag Tag, Tree, Tunneling XML XML, XServer, Xming ajax, angular, animated balancing cloud, commenting, connectivity datatables diaspora dropdown geocoding grep, ipaddress, ipv6, java, mysql nokogiri, octopress-migration octopress-plugin openssl powershell proxy rails, repo reviews ruby, script scripts, security, sharepoint shell ssh, telnet, vi, vieditor vim, visualblock, webattacks windows,cleanup windowsxp