in reply to Re: Keeping LDAP connectsion between program runs
in thread Keeping LDAP connections between program runs

I ran across that, but the LDAP connection isn't a DBI connection, so I'm not sure that would help.

I'm not using mod_perl. We don't need it for performance reasons on the web server and I don't have any experience with it, but I could learn if that's the only real solution.

  • Comment on Re^2: Keeping LDAP connectsion between program runs

Replies are listed 'Best First'.
Re^3: Keeping LDAP connectsion between program runs
by idsfa (Vicar) on Aug 30, 2005 at 21:23 UTC

    I believe you want DBD::LDAP (in conjunction with Apache::DBI)

    use DBI; $dbh = DBI->connect("DBI:LDAP:ldapdb",'user','password') or die "Cannot connect as user: " . $DBI::errstr; $dbh = DBI->connect("DBI:LDAP:ldapdb") #ANONYMOUS or die "Cannot connect as guest (readonly): " . $DBI::errstr;

    Updated: You might also want to look at ResourcePool, which specifically calls out Net::LDAP connection caching as a target use.


    The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. -- Cyrus H. Gordon
Re^3: Keeping LDAP connectsion between program runs
by philcrow (Priest) on Aug 30, 2005 at 21:01 UTC
    Even if the rest of your app doesn't need mod_perl for performance, this part may. The whole purpose of mod_perl is to save time through persistence inside an apache instance. Using mod_perl, it is easy to keep the connection open from hit to hit. And to pool connections in all sorts of ways.

    Even though I haven't used LDAP, it seems from your description that it is similar in spirit to a database in that a client opens a connection to the server. Building that connection takes time and eventually becomes a bottlenck.

    Apache::DBI could serve as a code modle for an Apache::LDAP if one does not already exist. Having written the last sentence, I went to search cpan and found Apache::AuthenLDAP and its cousin Apache::AuthzLDAP. These might be just what you need, or another model for your own code.

    Phil