Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
There's more than one way to do things
 
PerlMonks  

Re^2: Keeping LDAP connectsion between program runs

by jpfarmer (Pilgrim)
on Aug 30, 2005 at 16:37 UTC ( [id://487938]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 philcrow (Priest) on Aug 30, 2005 at 17: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

Re^3: Keeping LDAP connectsion between program runs
by idsfa (Vicar) on Aug 30, 2005 at 17: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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://487938]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.