Menu

Sybase 15 and SSL connections

Help
eviscerate
2008-09-23
2019-10-14
  • eviscerate

    eviscerate - 2008-09-23

    Hi,

    I see from the FAQ that the latest version of JTDS driver supports SSL connections.

    I do not have much experience of this so does anyone have any tips, hints, etc? Do I need anything other than just adding ssl=require to my connection properties?

    BTW: I am using JDK 1.3.1 (yes I know it is ancient but it is a long story).

     
    • Pedro Silva

      Pedro Silva - 2009-08-03

      Ok I'm having the same problem here.
      I've already enabled ssl on the database via the config file and also generated the certificate for the client.
      Using the Sybase central I can see it only accepts connection using ssl (also the icon now shows a little locket icon showing it works with a secure channel). I've also tested sniffing the network with wireshark and I can see that no clear text password is going through the network like it was before.

      But the problem is when I try to use jtds to connect using the ssl option either directly in the connection string or add it to the properties that goes into the drivermanager it gives an error on the getConnection method.

              Connection dbcon =
                  DriverManager.getConnection(
                      theServer,
                      pConnect
                      );
      

      Netbeans output:
      run:
      java.sql.SQLException: I/O Error: Connection reset
      at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2307)
      at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:602)
      at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:344)
      at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
      at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
      at java.sql.DriverManager.getConnection(DriverManager.java:582)
      at java.sql.DriverManager.getConnection(DriverManager.java:185)
      at javaapplication1.Connect.makeConnection(Connect.java:27)
      at javaapplication1.Connect.<init>(Connect.java:18)
      at javaapplication1.Connect.main(Connect.java:37)
      Caused by: java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream.java:168)
      at java.io.DataInputStream.readFully(DataInputStream.java:178)
      at java.io.DataInputStream.readFully(DataInputStream.java:152)
      at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:841)
      at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:722)
      at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466)
      at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103)
      at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2202)
      ... 9 more
      Connection Failure
      BUILD SUCCESSFUL (total time: 2 seconds)

      I'm using jdk 1.6 and does jtds really suport ssl for sybase or not?

       
      • eviscerate

        eviscerate - 2009-08-03

        After over a week of investigations, hair pulling and frustration that no one was around to help me I never ever did find a solution for this using the jTDS driver. In the end I used the Sybase own jconn driver. The jconn driver doesn't support SSL either directly however what it does allow is for you to establish the socket connection yourself and then pass this socket to the driver to use. This I did and it works beautifully. The docs for the jconn driver were very helpful with this. I wish all drivers offered this ability as it is massively useful! (jTDS developers take note!)

         
        • momo

          momo - 2009-08-04

          Sorry, but jTDS currently only supports SSL for Microsoft Server 2000 and above. I added a feature request for Sybase... [2831892]

           
  • Gajendra Agrawal

    has JTDS added SSL Support for Sybase?

     

Log in to post a comment.