You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Rafiq Ismail (ADMIN)" <ra...@joshua.dreamthought.com> on 2002/08/09 12:01:23 UTC

Apache::Session HELP!

Hi, I'm in major poop.

Got a presentation soon and my just implemented, implementation of
Apache::Session is not working as per the man page.

I've set commit to 1 and tied a session to a postgres database.  I then
set a field and check the table it's not there.

When I later do a fetch on it, I get a scarey error:

 [error] Object does not exist in the data store at
/usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Postgres.pm line 81


Create and fetch methods, with table schema, below:


1)Create:
--------------------------------------------

sub tieSession
{
  my $self = shift;
  my %session;
  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;

  print STDERR "\n CREATING SESSION using dsn: $dsn \n";

  tie %session, 'Apache::Session::Postgres', undef,
                {
		 DataSource => $dsn,
		 UserName => $DBI_USER,
		 Password => $DBI_PWD,
		 Commit => 1
		};

  ## store creation time
  $session{CREATION_TIME}=time;

  return \%session;
}

--------------------------------------------



2) fetching the session:

--------------------------------------------

sub fetchSession
{
  my $self = shift;
  my $sessionId = shift;
  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;
  my %session;

  print STDERR "\n getting session for $sessionId\n";

  tie %session, 'Apache::Session::Postgres', $sessionId,
    { DataSource => $dsn,
      UserName => $DBI_USER,
      Password => $DBI_PWD,
      Commit => 1
    };

  ## store last access
  $session{LAST_ACCESS} = time;

  $ENV{GUEST_ID} = $session{GUEST_ID} || undef;
  return \%session;
}

--------------------------------------------

3) Table Schemata

--------------------------------------------

        CREATE TABLE sessions (
           id char(32) not null primary key,
           a_session text
        );

--------------------------------------------


help?

Cheers,

fiq



Re: Apache::Session HELP!

Posted by Fran Fabrizio <ff...@mmrd.com>.
Wait, ignore that - I was getting my Apache::Session and my 
Apache::AuthCookie signals crossed.  Sorry.

-Fran


Fran Fabrizio wrote:

>
> What does your config file look like?  All pointing at the right 
> tables and fields and such?
>
> -Fran
>
> Rafiq Ismail (ADMIN) wrote:
>
>> Hi, I'm in major poop.
>>
>> Got a presentation soon and my just implemented, implementation of
>> Apache::Session is not working as per the man page.
>>
>> I've set commit to 1 and tied a session to a postgres database.  I then
>> set a field and check the table it's not there.
>>
>> When I later do a fetch on it, I get a scarey error:
>>
>> [error] Object does not exist in the data store at
>> /usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Postgres.pm line 81
>>
>>
>> Create and fetch methods, with table schema, below:
>>
>>
>> 1)Create:
>> --------------------------------------------
>>
>> sub tieSession
>> {
>>  my $self = shift;
>>  my %session;
>>  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;
>>
>>  print STDERR "\n CREATING SESSION using dsn: $dsn \n";
>>
>>  tie %session, 'Apache::Session::Postgres', undef,
>>                {
>>          DataSource => $dsn,
>>          UserName => $DBI_USER,
>>          Password => $DBI_PWD,
>>          Commit => 1
>>         };
>>
>>  ## store creation time
>>  $session{CREATION_TIME}=time;
>>
>>  return \%session;
>> }
>>
>> --------------------------------------------
>>
>>
>>
>> 2) fetching the session:
>>
>> --------------------------------------------
>>
>> sub fetchSession
>> {
>>  my $self = shift;
>>  my $sessionId = shift;
>>  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;
>>  my %session;
>>
>>  print STDERR "\n getting session for $sessionId\n";
>>
>>  tie %session, 'Apache::Session::Postgres', $sessionId,
>>    { DataSource => $dsn,
>>      UserName => $DBI_USER,
>>      Password => $DBI_PWD,
>>      Commit => 1
>>    };
>>
>>  ## store last access
>>  $session{LAST_ACCESS} = time;
>>
>>  $ENV{GUEST_ID} = $session{GUEST_ID} || undef;
>>  return \%session;
>> }
>>
>> --------------------------------------------
>>
>> 3) Table Schemata
>>
>> --------------------------------------------
>>
>>        CREATE TABLE sessions (
>>           id char(32) not null primary key,
>>           a_session text
>>        );
>>
>> --------------------------------------------
>>
>>
>> help?
>>
>> Cheers,
>>
>> fiq
>>
>>  
>>
>
>




Re: Apache::Session HELP!

Posted by Fran Fabrizio <ff...@mmrd.com>.
What does your config file look like?  All pointing at the right tables 
and fields and such?

-Fran

Rafiq Ismail (ADMIN) wrote:

>Hi, I'm in major poop.
>
>Got a presentation soon and my just implemented, implementation of
>Apache::Session is not working as per the man page.
>
>I've set commit to 1 and tied a session to a postgres database.  I then
>set a field and check the table it's not there.
>
>When I later do a fetch on it, I get a scarey error:
>
> [error] Object does not exist in the data store at
>/usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Postgres.pm line 81
>
>
>Create and fetch methods, with table schema, below:
>
>
>1)Create:
>--------------------------------------------
>
>sub tieSession
>{
>  my $self = shift;
>  my %session;
>  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;
>
>  print STDERR "\n CREATING SESSION using dsn: $dsn \n";
>
>  tie %session, 'Apache::Session::Postgres', undef,
>                {
>		 DataSource => $dsn,
>		 UserName => $DBI_USER,
>		 Password => $DBI_PWD,
>		 Commit => 1
>		};
>
>  ## store creation time
>  $session{CREATION_TIME}=time;
>
>  return \%session;
>}
>
>--------------------------------------------
>
>
>
>2) fetching the session:
>
>--------------------------------------------
>
>sub fetchSession
>{
>  my $self = shift;
>  my $sessionId = shift;
>  my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST;
>  my %session;
>
>  print STDERR "\n getting session for $sessionId\n";
>
>  tie %session, 'Apache::Session::Postgres', $sessionId,
>    { DataSource => $dsn,
>      UserName => $DBI_USER,
>      Password => $DBI_PWD,
>      Commit => 1
>    };
>
>  ## store last access
>  $session{LAST_ACCESS} = time;
>
>  $ENV{GUEST_ID} = $session{GUEST_ID} || undef;
>  return \%session;
>}
>
>--------------------------------------------
>
>3) Table Schemata
>
>--------------------------------------------
>
>        CREATE TABLE sessions (
>           id char(32) not null primary key,
>           a_session text
>        );
>
>--------------------------------------------
>
>
>help?
>
>Cheers,
>
>fiq
>
>  
>