haizhiziNO1
haizhiziNO1
2016-01-13 02:02

求助各位大神,这个程序哪里有问题

1
  • sql

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class test8 {
public static void main(String[] args)
{
Connection ct=null;
Statement sm=null;
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
ct=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=news", "sa", "123456");
sm=ct.createStatement();
int i=sm.executeUpdate("insert into xinwen values('111','159','159')");
if(i==1)
{
System.out.print("增加成功");
}
else
{
System.out.print("增加失败");
}
}
catch(Exception e){
}
finally {

    }
}

}

错误内容:Exception in thread "main" java.lang.NoSuchMethodError: sun.security.ec.NamedCurve.(Ljava/lang/String;Ljava/lang/String;Ljava/security/spec/EllipticCurve;Ljava/security/spec/ECPoint;Ljava/math/BigInteger;I)V
at sun.security.ec.CurveDB.add(CurveDB.java:147)
at sun.security.ec.CurveDB.(CurveDB.java:171)
at sun.security.ec.SunECEntries.putEntries(SunECEntries.java:72)
at sun.security.ec.SunEC.(SunEC.java:76)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:221)
at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:206)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:206)
at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:187)
at sun.security.jca.ProviderList.getProvider(ProviderList.java:233)
at sun.security.jca.ProviderList.getService(ProviderList.java:331)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:157)
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1590)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1323)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at test8.main(test8.java:11)

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

6条回答