Oracle 已经宣布 11g R2 支持 IPV6,而 ojdbc6.jar 是正确的。
但是当我测试它时,我得到了异常,你解决了吗?
我的测试代码是:
import java.sql.SQLException;
import java.util.Properties;
public class Test {
final static String sDBDriver = "oracle.jdbc.driver.OracleDriver";
/**
* @param args
* @throws SQLException
*/
public static void main(String[] args) throws SQLException {
// TODO Auto-generated method stub
java.sql.Connection conn=null;
String url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=
[fe80::b056:5cff:fe78:b672])(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=fnstdb1))";
try
{
Class.forName(sDBDriver);
conn = DriverManager.getConnection(url,"scott","fnst1234");
}
catch (Exception e)
{
System.out.println("ERROR:"+e.getMessage());
}
finally
{
System.out.println("连接是否关闭:"+conn.isClosed());
conn.close();
}
}
}
我使用以下cmd:
java -cp ojdbc6.jar -Djava.net.preferIPv6Addresses=true Test
但结果是:ERROR:NL Exception was generated
怎么了?