Thread: Sessions with Postgres

Sessions with Postgres

From
Robert
Date:
Hi,

  sorry for crossposting. I'd like to use Apache::Session with Postgres
as a backend (from HTML::Embperl if possible), but I'm still having
problems. People on these lists complain from time to time that they
have problems with this combination but searching archives don't give
many advices / just list of problems...

  Is anybody here using Apache::Session/Postgres combination without
problems? If so, could you be so kind as to post your configuration? If
not, how far did you get last time you tried? Is anybody interested in
using it at all?

  Sorry if I sound a bit pessimistic - I applied patch Angus Lee posted
week ago on Embperl list and it almost works, but I still have some idle
postgres backend hanging around. It's getting really frustrating.

  - Robert

Re: Sessions with Postgres

From
Vivek Khera
Date:
>>>>> "r" == robert  <robert@robert.cz> writes:

r>   Is anybody here using Apache::Session/Postgres combination without
r> problems? If so, could you be so kind as to post your configuration? If
r> not, how far did you get last time you tried? Is anybody interested in
r> using it at all?

works like a charm.  I didn't have to do anything special when I
converted from MySQL -- just change the driver and poof, it worked.

here's a clip of code.  $dbh is an already-opened handle to a DBD::Pg
object.

use Apache::Session::Postgres;

    # ok, so now create a session for them and use that session ID
    # as their cookie value
    my %session;
    eval {
      tie %session, 'Apache::Session::Postgres', undef,
    {
     Handle => $dbh,
     Commit => 0,
    };
    };


and to pull the session back out:

    my %session;
    eval {
      my $dbh = openDB();
      tie %session, 'Apache::Session::Postgres', $key,
    {
     Handle => $dbh,
     Commit => 0,
    };
    };

What is it that you are doing?

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera   http://www.khera.org/~vivek/

Re: Re: Sessions with Postgres

From
Robert
Date:
Vivek Khera wrote:
>
> >>>>> "r" == robert  <robert@robert.cz> writes:
>
> r>   Is anybody here using Apache::Session/Postgres combination without
> r> problems? If so, could you be so kind as to post your configuration? If
> r> not, how far did you get last time you tried? Is anybody interested in
> r> using it at all?
>
> works like a charm.  I didn't have to do anything special when I
> converted from MySQL -- just change the driver and poof, it worked.

Aha, so maybe all my problems come from HTML::Embperl, but just to make
sure:

- Postgres does its own locking, so I need only Null locker
- Postgres doesn't like binary strings so I need Base64 to encode
session data

Am I right?

- Robert