I want to setup LDAP server with postgres Backend.

I have followed the link http://www.darold.net/projects/ldap_pg/HOWTO/

I am able to successfully configure it till step 4 of this tutorial.
And when i make LDAPSearch it returns me an object as well.

But when I try to use ldapadd it returns me an error
ldap_bind: Invalid credentials (49)

The command i use is:
ldapadd -x -W -D "cn=admin,dc=domain,dc=com" -f file.ldif


This is my slap.conf file at location /usr/local/etc/openldap

include         /usr/local/etc/openldap/schema/core.schema
include         /usr/local/etc/openldap/schema/cosine.schema
include         /usr/local/etc/openldap/schema/inetorgperson.schema

pidfile         /usr/local/var/slapd.pid
argsfile        /usr/local/var/slapd.args

database        sql
suffix          "dc=domain,dc=com"
rootdn          "cn=admin,dc=domain,dc=com"
rootpw          EDLEa8yM/upyM9ixUgf8Aui2Cfl66cRV
dbname          pg_ldap
dbuser          postgres
dbpasswd        admin
insentry_stmt   "insert into ldap_entries (id,dn,oc_map_id,parent,keyval)
values ((select max(id)+1 from ldap_entries),?,?,?,?)"
upper_func      "upper"
strcast_func    "text"
concat_pattern  "?||?"
has_ldapinfo_dn_ru      no




file.lidf


# begin

o=domain, c=com
objectClass=organization

o=domain
description=domain

cn=admin, o=domain, c=com
objectClass=organizationalRole
cn=admin
description= manager

# end

Can anyone please help me.

Thanks in advance.