Page tree
Skip to end of metadata
Go to start of metadata

Title - ODBC and LDAPS (used as a Directory Service) on Windows


Starting with SDK 15.7 SP100 ODBC can use LDAPS as a Directory Service.

This wiki will help understand this new feature.


LDAP is used to authenticate users or as a Directory Service to distribute server information.

When using LDAP as a Directory Service a client sends a request to LDAP with a username and password.
If this is accepted, LDAP replies with the requested server information.
This is useful when you want to conceal the host and port or want to keep the information off of all client boxes.
Also this allows admins to add/modify/delete LDAP server entries so all clients are affected at once.


Open an ODBC DSN from the ODBC Data Source Administrator
start > programs >Sybase > DataAccess (32/64)
Go to the Connection tab

Full url: ldap://,dc=sybase,dc=com
My authentication is set very unsecure and open.
You can also add this to your URL to use an account to authenticate to LDAP.

This example shows cn=Manager which is my root admin account.
From: Software Developer's Kit 15.7 > Open Client and Open Server Configuration Guide for UNIX > Using a Directory Service

Service name = server entry entered into LDAP

Wireshark TDS trace between my client and the LDAP server shows this being brought back to ODBC.

Notice it replayed with my LDAP server entry SSL.
Host - ldkim-sun
Port - 4545
Protocol - TDS

Now that we understand what LDAP does, let's look further into LDAPS.
The example above sent normal plain text LDAP server.
Wireshark, a protocol TDS capture tool, was used to trace every packet sent between the servers.
However, since we want to be secure and send encrypted packets between servers, LDAPS is the direction to go.


LDAPS is a SSL encrypted LDAP server port.

To enable LDAP to LDAPS you need to create SSL certificates on the LDAP server and distribute the certificates to the clients that want to connect.

SSL certificates are used to establish a SSL Handshake at the beginning of a connection.
Once client and server agree upon an encryption suite and the server has verified the client has a valid certificate, then traffic between the two are encrypted.

If you already have an established LDAP server, items to add:

Note: This is an example of a test environment self signed certificates.
Self Signed certificates are not meant for a production environment.


TLSCertificateFile      <location to signed crt>/<hostname>.crt
TLSCertificateKeyFile   <location to signed key>/<hostname>.key
TLSCACertificateFile    <location to self signed>/ca.crt


URI     ldaps:// ldaps://
starting LDAPS-
slapd -h "ldaps://<hostname>:636" -d 255 -f ./slapd.conf


When using LDAPS as a Directory Service, isql is able to establish a connection and receive the host and port information through the libtcl.cfg and trusted.txt files.

However, ODBC, on Windows, uses Microsoft's API to setup this interaction between ODBC and LDAPS.
To allow ODBC to use a SSL certificate we must use the Windows tool Microsoft Management Console (MMC).

This tool controls the SSL certificates and allows us to manage them.

To add a certificate:
Type mmc in the search box.
 Open the certificates section:
file > add/remove snap-ins.. > select certificates > "Add >"  Computer account > Finish > Ok
Now you should see the Certificates in the left pane.

Here we can right click > All tasks > import... our LDAPS ssl certificates.

Once you have imported your LDAPS SSL certificate you can connect to your LDAPS through ODBC.

The only difference now is we change the URL from LDAP to LDAPS:

(Remember above this can be read by everyone, make sure you have permissions setup.)

Also, based on your SDK version, you may be restricted to the default SSL ports 636 and 3269.
Note: 636 and 3269 ports are the default set by Microsoft to use SSL encryption.
Sybase CR#: 738898 was created to resolve this issue. Should be fixed in SDK 15.7 SP110.

Related Content

Related Documents

Wireshark - TDS Network Protocol Analyzer 

Related sap notes/kbas

  • No labels