Microsoft JDBC driver 3.0 on JRE 1.6.21(32bit) failed to connect to MSSQL


  • Our java application sometimes has problems getting new connections.  An Error occur, everyday after restarting the machine.

    • Client OS: Microsoft Windows 2008r2 SE x64 (Our java application and SQL Server are same machine)
    • JDBC Driver:  "Microsoft SQL Server JDBC Driver 3.0" VERSION "3.0.1301.101"
    • Java: JRE 1.6u21(32bit)
    • SQL Server: Microsoft SQL Server Standard Edition (64-bit) 10.50.1617.0
    • Windows task scheduler calls our application every 11PM.

    My Questions are:

    • Did Jdbc Driver try to write any log?  Why JDBC Driver couldn't write any log?
    • What does this error indicate?

    Error message:

    TDSChannel (ConnectionID:1) write failed:Connection reset by peer: socket write error logException

    JDBC driver log(Stacktrace):

     (): Connection reset by peer: socket write error Connection reset by peer: socket write error
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
    2013/08/28 23:11:32 enableSSL
    INFO: path: C:\Program Files (x86)\Java\jre6\lib\security
    Security providers: [SUN version 1.6, SunRsaSign version 1.5, SunJSSE version 1.6, SunJCE version 1.6, SunJGSS version 1.0, SunSASL version 1.5, XMLDSig version 1.0, SunPCSC version 1.6, SunMSCAPI version 1.6]
    SSLContext provider info: Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
    SSLContext provider services:
    [SunJSSE: KeyFactory.RSA ->
      aliases: [1.2.840.113549.1.1, OID.1.2.840.113549.1.1]
    , SunJSSE: KeyPairGenerator.RSA ->
      aliases: [1.2.840.113549.1.1, OID.1.2.840.113549.1.1]
    , SunJSSE: Signature.MD2withRSA ->$MD2withRSA
      aliases: [1.2.840.113549.1.1.2, OID.1.2.840.113549.1.1.2]
    , SunJSSE: Signature.MD5withRSA ->$MD5withRSA
      aliases: [1.2.840.113549.1.1.4, OID.1.2.840.113549.1.1.4]
    , SunJSSE: Signature.SHA1withRSA ->$SHA1withRSA
      aliases: [1.2.840.113549.1.1.5, OID.1.2.840.113549.1.1.5,, OID.]
    , SunJSSE: Signature.MD5andSHA1withRSA ->
    , SunJSSE: KeyManagerFactory.SunX509 ->$SunX509
    , SunJSSE: KeyManagerFactory.NewSunX509 ->$X509
    , SunJSSE: TrustManagerFactory.SunX509 ->$SimpleFactory
    , SunJSSE: TrustManagerFactory.PKIX ->$PKIXFactory
      aliases: [SunPKIX, X509, X.509]
    , SunJSSE: SSLContext.SSL ->
    , SunJSSE: SSLContext.SSLv3 ->
    , SunJSSE: SSLContext.TLS ->
    , SunJSSE: SSLContext.TLSv1 ->
    , SunJSSE: SSLContext.Default ->
    , SunJSSE: KeyStore.PKCS12 ->
    java.ext.dirs: C:\Program Files (x86)\Java\jre6\lib\ext;C:\Windows\Sun\Java\lib\ext

    • Edited by msmt_ Tuesday, September 10, 2013 11:02 AM
    Friday, September 06, 2013 6:35 AM

All replies

  • Hi msmt_,

    "Connection Reset by Peer" means that SQL Server is terminating the connection prematurely. It can have many causes so I suggest looking at both the SQL Server Profiler Traces and the JDBC Driver Diagnostic Logs and try to determine what was the operation immediately before the connection was terminated.
    Here is how to enabled Logging in the JDBC driver:

    An exception occurred during the DBComms.receive method

    Allen Li
    TechNet Community Support

    Monday, September 09, 2013 1:47 AM
  • Hi Allen Li,

    Thanks to reply!
    JDBC driver log is already enabled.
    Isn't it enough?

    Current setting is following: = FINEST = FINEST = FINE = FINE

    JDBC driver log that is in above.

    Do you know what "socket write error" means?
    Did JDBC driver fail establish SSL connection? or fail something else?
    Tuesday, September 10, 2013 11:01 AM
  • Hai, are u able to find a solution, I am using JDBC4.0, and its showing the same SSL problems, I think MICROSOFT HAS SCREWED UP ON THIS.............................BIG TIME MICROSOFT ISSUES SOME BIG UPDATE ON THIS, THOUGH THERE ARE MANY UPDATES IT SEEMS THEY ARE ALL FOR A TIME PASS.
    Sunday, November 24, 2013 3:04 PM