- 论坛徽章:
- 0
|
在win 2003 server下配置好了IPV6协议,获取到分配的IPV6地址,ipconfig得到的
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 9.181.85.19
Subnet Mask . . . . . . . . . . . : 255.255.255.0
IP Address. . . . . . . . . . . . : fe80::20d:60ff:fe92:c31b%5
Default Gateway . . . . . . . . . : 9.181.85.1
安装的是DB2 9,已经支持IPV6了,我希望验证是否能用IPV6地址访问数据源,写了下面这个简单的链接,但是都报错不能识别出IPV6地址,我也用了[fe80::20d:60ff:fe92:c31b%5]或者[::1]也不行,换成localhost或者127.0.0.1可以,怀疑是机器还有那里没有配置好。希望有大虾能指点迷津,谢谢!
public static void main(String[] args) throws SQLException {
try {
Class.forName("com.ibm.db2.jcc.DB2Driver");
String databaseURL = "jdbc:db2://[fe80::20d:60ff:fe92:c31b]:50000/sample";
java.util.Properties properties = new java.util.Properties ();
properties.setProperty ("user","user");
properties.setProperty ("password","password");
Connection conn = DriverManager.getConnection(databaseURL,properties);
/**//** print any error messages **/
if(conn==null){System.out.println("Connection Failed \n");
}else
{
System.out.println("Connection Got it");
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
|