import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
/**
*
* @author qyf
*
*/
public class IPv6JdbcUtil {
public static void main(String[] args) {
try {
boolean ipv6 = true;
testDb2Connection(ipv6);
testMySQLConnection(ipv6);
testOracleConnection(ipv6);
testSqlServerConnection(ipv6);
testSybaseConnection(ipv6);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
*ipv4 Driver URL:
*jdbc:mysql://127.0.0.1:3306/database
*ipv6 Driver URL:
*jdbc:mysql://address=(protocol=tcp)(host=2001:470:23:13::6)(port=3306)/database
*
* Deiver package version 5.1.31 以上
*
* @throws ClassNotFoundException
* @throws SQLException
*
*/
public static void testMySQLConnection(boolean ipv6) throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.jdbc.Driver");
String jdbcIpv4Url = "jdbc:mysql://127.0