Announcement Announcement Module
Collapse
No announcement yet.
Use single LDAP connexion Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use single LDAP connexion

    Hi,
    following my goal:
    - My application should connect to an LDAP (using ldaptemplate), retreive data and then close connection. The retrieved data will reside in an ehcache instance.
    Every Hour, the cache expire and my application will reconnect to the LDAP to retrieve the fresh datas.

    I'm using the following configuration to feat to my need, I'm using a pool with 1 connection that expire after 10s of inactivity.
    -Dcom.sun.jndi.ldap.connect.timeout=10000
    -Dcom.sun.jndi.ldap.connect.pool=true
    -Dcom.sun.jndi.ldap.connect.pool.maxsize=1


    I thought that my config will ensure that the maximum number of connections will be 1. this was not the case.

    Could you please tell me what's wrong with my approach and if there is another one to feet my objective ?

  • #2
    For the details on pooling I'd have to refer you to the Java LDAP documentation. Spring LDAP does not touch the pooling issues at all, other than turning it on or off.

    However, looking at your situation I don't see any use for pooling at all. I think you should turn off pooling completely, by setting the 'pooled' flag of your ContextSource to false.

    Comment


    • #3
      RE : Single LDAP connection

      Thank you rasky for your prompt reply

      Originally posted by rasky View Post
      For the details on pooling I'd have to refer you to the Java LDAP documentation. Spring LDAP does not touch the pooling issues at all, other than turning it on or off.
      > I agree with you (I sow your other posts on pooling issues)

      Originally posted by rasky View Post
      However, looking at your situation I don't see any use for pooling at all. I think you should turn off pooling completely, by setting the 'pooled' flag of your ContextSource to false.
      I want to make dozens of requests using the same connection and then close asap the connection (this scenario will be reproduced each 1 hour, when the data cache expire).
      since the ldaptemplate call DirContext.close() for each request, I want to ensure that it will not close the connection but turn it back to the pool.

      I guess that turning off pooling will create a new connection for each operation.

      could you please advice me how can I "properly" implement my use case using Spring Ldap ?

      best regards,
      Anis zouaoui

      Comment

      Working...
      X