Form Server
Furlough Request
PDF Merge
Recycler Inventory Record
Recycler Tow Log
Vehicle Dismantle Request
Vehicle Title and Registration
Service Apps
Patient Outcomes
Med Credentials
Project: Sync2Ldap
Client(s): MicroWeb, Avaya, Inc (website)
Keywords: Java, JDBC, LDAP Directoy, Database Synchronization
Description: Sync2Ldap is a Java utility program used to synchronize a database table with a LDAP directory.

Project Summary
We have several web-based applications that require some sort application level database for managing user accounts and generating reports. Many of our web-based applications utilize a company's LDAP directory for single sign-on capability and updating records when users logon to the application. The benefits of this strategy is that applications can automatically recognize new employees to the organization and reject those that have been removed without intervention from the application administrator. The drawback to this strategy is that the application database only gets updated when user logs on to use the application. If the user does not logon to the tool or leaves the organization, the application level database can become out of sync with the current company structure. This can create discrepencies on reports generated from user profiles (Ex. Sales by cost center, department, etc.)

Sync2Ldap was created as a means to update the application database records with current information stored in a company's LDAP directory. The Sync2Ldap program is scheduled to run at reqular intervals (Windows schedule service or Unix cron job) to update one or more application databases.


  • Java 2 runtime environment (J2SE)
  • JDBC driver for database that will be updated
  • LDAP Directory to synchronize against

Tested Systems

Note: Sync2Ldap does NOT work with the Sun Microsystems jdbc:odbc bridge.

Program Usage
To run the program on a Windows machine, enter the following at the command prompt or within a batch file. Internally, we utilize a single batch file that runs the program using different configuration files for each database that needs updating. The batch file is then scheduled to run using the Windows Schedule Service.

Command Line
	C:\MicroWeb\Sync2Ldap>java -jar Sync2Ldap.jar <config_file>
Note: The default configuration file is named Sync2Ldap.ini, if not specified on the command line.

Configuration File Parameters
app.debug [yes|no] : turns debug messages on/off
db.driver The JDBC driver used to access the master database.
Example (MySQL database):
db.url The JDBC driver connection paramters used to access the master database.
Example (MySQL database):
db.dateformat The date format used by the master database.
Example (MySQL database):
db.dateformat=yyyy-MM-dd The name or IP address of the LDAP directory server.
ldap.base The search base of where to search the LDAP directory server.
ldap.user The user name required to search the LDAP directory server. If this is blank, an anonymous search will be performed.
ldap.pwd The password required to search the LDAP directory server.
sync.table The name of the table that will be synchronized. The table name must be the same on the master and remote databases.
Example: sync.table=Employee
sync.keyfield The name of the table primary key field.
Example: sync.keyfield=hrid
sync.keymap The name of the LDAP directory attribute that corresponds to the table primary key. This is used to match records in the database with those in the LDAP directory.
Example: sync.keyfield=uid
sync.notfound The name of the database field that will be set to a value of 1 if a matching record is NOT found in the LDAP directory. This is used to identify employees that have left the organization.
Example: sync.notfound=isUnknown
sync.filter The filter string used to determine which records to synchronize. By default, this is left blank to update all records in the table.
Example: (synchronize records where the region field is 'EMEA'):
sync.filter=Region='EMEA' Sync2Ldap can synchronize up to 100 table fields. N is a number from 0 to 99 that indicates a field to synchronize.
Example: (synchronize six fields with the ldap directory)

Note: The numbers do not need to be in order. For example, to skip the Handle field above, remove the text after the = character as shown below.

Sample Batch File (Sync2Ldap.bat)

# Run Sync2Ldap to synchronize application databases with Ldap directory
# Use java classpath option to tell system where file is located
# The Sync2Ldap.jar file is installed in the C:\MicroWeb\Sync2Ldap folder

cd C:\MicroWeb\Sync2Ldap
java -jar Sync2Ldap.jar SyncApp01.ini
java -jar Sync2Ldap.jar SyncApp02.ini
java -jar Sync2Ldap.jar SyncApp03.ini


Copyright (c) 2019 by MicroWeb. All Rights Reserved