The following error always occurs when you connect to sqlserver2005 using Java.
Jan 24,200 8 12:05:34 com. Microsoft. sqlserver. JDBC. tdschannel enablessl
Information: Java. Security path: C: \ Java \ jre6 \ Lib \ Security
Security Providers: [Sun version 1.6, sunrsasign version 1.5, sunjsse version 1.6, sunjgss Version 1.0, sunsasl version 1.5, xmldsig Version 1.0, sunpcsc version 1.6]
Sslcontext provider info: Sun JSSE provider (PKCS12, sunx509 key/trust factories, SSLv3, tlsv1)
Sslcontext provider services:
[Sunjsse: keyfactory. RSA-> sun. Security. RSA. rsakeyfactory
Aliases: [1.2.840.113549.1.1, oid.1.2.840.113549.1.1]
, Sunjsse: keypairgenerator. RSA-> sun. Security. RSA. rsakeypairgenerator
Aliases: [1.2.840.113549.1.1, oid.1.2.840.113549.1.1]
, Sunjsse: Signature. md2withrsa-> sun. Security. RSA. rsasignature $ md2withrsa
Aliases: [1.2.840.113549.1.1.2, oid.1.2.840.113549.1.1.2]
, Sunjsse: Signature. md5withrsa-> sun. Security. RSA. rsasignature $ md5withrsa
Aliases: [1.2.840.113549.1.1.4, oid.1.2.840.113549.1.1.4]
, Sunjsse: Signature. sha1withrsa-> sun. Security. RSA. rsasignature $ sha1withrsa
Aliases: [1.2.840.113549.1.1.5, oid.1.2.840.113549.1.1.5, 1.3.14.3.2.29, oid.1.3.14.3.2.29]
, Sunjsse: Signature. md5andsha1withrsa-> com.sun.net. SSL. Internal. SSL. rsasignature
, Sunjsse: keymanagerfactory. sunx509-> com.sun.net. SSL. Internal. SSL. keymanagerfactoryimpl $ sunx509
, Sunjsse: keymanagerfactory. newsunx509-> com.sun.net. SSL. Internal. SSL. keymanagerfactoryimpl $ X509
, Sunjsse: trustmanagerfactory. sunx509-> com.sun.net. SSL. Internal. SSL. trustmanagerfactoryimpl $ simplefactory
, Sunjsse: trustmanagerfactory. pkix-> com.sun.net. SSL. Internal. SSL. trustmanagerfactoryimpl $ pkixfactory
Aliases: [sunpkix, X509, X.509]
, Sunjsse: sslcontext. SSL-> com.sun.net. SSL. Internal. SSL. sslcontextimpl
, Sunjsse: sslcontext. SSLv3-> com.sun.net. SSL. Internal. SSL. sslcontextimpl
, Sunjsse: sslcontext. TLS-> com.sun.net. SSL. Internal. SSL. sslcontextimpl
, Sunjsse: sslcontext. tlsv1-> com.sun.net. SSL. Internal. SSL. sslcontextimpl
, Sunjsse: sslcontext. Default-> com.sun.net. SSL. Internal. SSL. defaultsslcontextimpl
, Sunjsse: keystore. PKCS12-> com.sun.net. SSL. Internal. pkcs12.pkcs12keystore
]
Java. Ext. dirs: C: \ Java \ jre6 \ Lib \ ext; C: \ WINDOWS \ sun \ Java \ Lib \ ext
Com. Microsoft. sqlserver. JDBC. sqlserverexception: Driver Program You cannot establish a secure connection to SQL server by using Secure Socket Layer (SSL) encryption. Error: "RSA premaster secret error ".
At com. Microsoft. sqlserver. JDBC. sqlserverconnection. Terminate (sqlserverconnection. Java: 1352)
At com. Microsoft. SQL Server. JDBC. tdschannel. enablessl (iobuffer. Java: 1533)
At com. Microsoft. sqlserver. JDBC. sqlserverconnection. connecthelper (sqlserverconnection. Java: 1042)
At com. Microsoft. sqlserver. JDBC. sqlserverconnection. login (sqlserverconnection. Java: 817)
At com. Microsoft. sqlserver. JDBC. sqlserverconnection. Connect (sqlserverconnection. Java: 700)
At com. Microsoft. sqlserver. JDBC. sqlserverdriver. Connect (sqlserverdriver. Java: 842)
At java. SQL. drivermanager. getconnection (unknown source)
At java. SQL. drivermanager. getconnection (unknown source)
At conndb. Main (conndb. Java: 14)
I checked the information on the Internet and found that someone said it was a problem with the JDBC driver package, but the problem still remained unsolved after I changed the driver package ..
Later, I changed window-> preference-> JAVA-> install jres to jre6, and the problem was solved ..
I used JDK, And the directory is in c: \ Program Files \ Java \ jdk1.6.0 _ 25. The directory changed to JRE is c: \ Program Files \ Java \ jre6.
Although I still don't know why, the problem is finally solved ..