Apache::Session problem with DBD::Oracle

2002-03-11 Thread Brian Lavender

I am trying to install Apache::Session and it is failing on
the DBD::Oracle tests. It is asking for a default user. Do
I need to configure Oracle for a default user? Or do I need
to set some environment variable with a user id and password?

brian

Here are the errors I am getting:

t/99oracle..DBI->connect(sgum) failed: ORA-01004: default username feature not 
supported; logon denied (DBD ERROR: OCISessionBegin) at 
blib/lib/Apache/Session/Store/Oracle.pm line 45
(in cleanup) DBI->connect(sgum) failed: ORA-01004: default username feature 
not supported; logon denied (DBD ERROR: OCISessionBegin) at 
blib/lib/Apache/Session/Store/Oracle.pm line 45
t/99oracle..dubious  
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 1-10
Failed 10/10 tests, 0.00% okay
-- 
Brian Lavender
http://www.brie.com/brian/



Re: Apache::Session problem with DBD::Oracle

2002-03-11 Thread Brian Lavender

Yup, that fixed it. 

I have another problem with the File portion. Seems that the test
giving the following fail statements. I checked /tmp and there is a
lock file. I am not sure about how File::Store all works, and I couldn't
quite understand the test file either. Should I just

$ make install 

anyway?

t/99dbfile..File exists at t/99dbfile.t line 77.
t/99dbfile..dubious  
Test returned status 17 (wstat 4352, 0x1100)
after all the subtests completed successfully
t/99dbfilestore.File exists at t/99dbfilestore.t line 73.
t/99dbfilestore.dubious  
Test returned status 17 (wstat 4352, 0x1100)
after all the subtests completed successfully


On Mon, Mar 11, 2002 at 02:33:17PM -0500, Geoffrey Young wrote:
> Brian Lavender wrote:
> > 
> > I am trying to install Apache::Session and it is failing on
> > the DBD::Oracle tests. It is asking for a default user. Do
> > I need to configure Oracle for a default user? Or do I need
> > to set some environment variable with a user id and password?
> 
> well, looking at t/99oracle.t (line 45) it looks like you need to
> define the following environment variables:
> 
> ORACLE_HOME (of course) 
> AS_ORACLE_USER
> AS_ORACLE_PASS
> 
> HTH
> 
> --Geoff

-- 
Brian Lavender
http://www.brie.com/brian/



Re: Apache::Session problem with DBD::Oracle

2002-03-11 Thread Brian Lavender

The tests were writing to an NFS mounted directory, and I think
NFS was creating some lock files which prevented the directory
from being written to. I moved the install to a non NFS mounted
area, and it all worked.

brian

On Mon, Mar 11, 2002 at 12:00:47PM -0800, Brian Lavender wrote:
> Yup, that fixed it. 
> 
> I have another problem with the File portion. Seems that the test
> giving the following fail statements. I checked /tmp and there is a
> lock file. I am not sure about how File::Store all works, and I couldn't
> quite understand the test file either. Should I just
> 
> $ make install 
> 
> anyway?
> 
> t/99dbfile..File exists at t/99dbfile.t line 77.
> t/99dbfile..dubious  
> Test returned status 17 (wstat 4352, 0x1100)
> after all the subtests completed successfully
> t/99dbfilestore.File exists at t/99dbfilestore.t line 73.
> t/99dbfilestore.dubious  
> Test returned status 17 (wstat 4352, 0x1100)
> after all the subtests completed successfully
> 
> 
> On Mon, Mar 11, 2002 at 02:33:17PM -0500, Geoffrey Young wrote:
> > Brian Lavender wrote:
> > > 
> > > I am trying to install Apache::Session and it is failing on
> > > the DBD::Oracle tests. It is asking for a default user. Do
> > > I need to configure Oracle for a default user? Or do I need
> > > to set some environment variable with a user id and password?
> > 
> > well, looking at t/99oracle.t (line 45) it looks like you need to
> > define the following environment variables:
> > 
> > ORACLE_HOME (of course) 
> > AS_ORACLE_USER
> > AS_ORACLE_PASS
> > 
> > HTH
> > 
> > --Geoff
> 
> -- 
> Brian Lavender
> http://www.brie.com/brian/

-- 
Brian Lavender
http://www.brie.com/brian/



Can't locate TIEHASH Apache::Session::Oracle

2002-03-11 Thread Brian Lavender

I am trying to test the Apache::Session::Oracle

Here is the error I am getting. What is wrong? I was able to
successfully install and test Apache::Session which tested 
Apache::Session::Oracle

This is the error.

[Mon Mar 11 14:01:23 2002] [error] Can't locate object method "TIEHASH" via package 
"Apache::Session::Oracle" at /opt/apache/perl/example.perl line 33.

This is the code I am testing.

use strict;
use Apache;
use CGI;
use Apache::Session::File;

my $db_user = 'user';
my $db_pass = 'pass';

my $r = Apache->request();

$r->status(200);
$r->content_type("text/html");

my $session_id = $r->path_info();
$session_id =~ s/^\///;

$session_id = $session_id ? $session_id : undef;

my %session;

tie %session, 'Apache::Session::Oracle', $session_id, {
   DataSource => 'dbi:Oracle:sgum',
   UserName   => $db_user,
   Password   => $db_pass,
   Commit => 1
  };

my $input = CGI::param('input');
$session{name} = $input if $input;

print<<__EOS__;

Hello
Session ID number is: $session{_session_id}
The Session ID is embedded in the URL

Your input to the form was: $input
Your name is $session{name}


http://penguin:8080/perl/example.perl/$session{_session_id}";>Reload this 
session
http://penguin:8080/perl/example.perl";>New session

http://penguin:8080/perl/example.perl/$session{_session_id}"; 
method="post">
  Type in your name here:
  
  

__EOS__

-- 
Brian Lavender
http://www.brie.com/brian/



Re: Can't locate TIEHASH Apache::Session::Oracle

2002-03-11 Thread Brian Lavender

On Mon, Mar 11, 2002 at 02:08:10PM -0800, Brian Lavender wrote:
> I am trying to test the Apache::Session::Oracle
> 
> Here is the error I am getting. What is wrong? I was able to
> successfully install and test Apache::Session which tested 
> Apache::Session::Oracle
> 
> This is the error.
> 
> [Mon Mar 11 14:01:23 2002] [error] Can't locate object method "TIEHASH" via package 
>"Apache::Session::Oracle" at /opt/apache/perl/example.perl line 33.
> 
> This is the code I am testing.
> 
> use strict;
> use Apache;
> use CGI;
> use Apache::Session::File;

Hmm, odd how I have a problem, and in the process of posting my question,
I figure it out. The above line just needs to be changed to:

use Apache::Session::Oracle;

and voila, it works.

brian
-- 
Brian Lavender
http://www.brie.com/brian/



Exiting a script, or how do you do exit?

2002-03-13 Thread Brian Lavender

I developing some code, which I am running under

Apache::Registry

I seem to recall that you don't want to put 

exit;

in a script, because the script continues to run. I have some
code, where I may send a redirect, and then I am done. Is there
a pseudo exit, or return command?

brian
-- 
Brian Lavender
http://www.brie.com/brian/



Re: Exiting a script, or how do you do exit?

2002-03-13 Thread Brian Lavender

Found the FAQ's. Seems that I can put in  

goto END;

and then put an end block in the code.

END: {
  1;
}

On Wed, Mar 13, 2002 at 07:07:18PM -0800, Brian Lavender wrote:
> I developing some code, which I am running under
> 
> Apache::Registry
> 
> I seem to recall that you don't want to put 
> 
> exit;
> 
> in a script, because the script continues to run. I have some
> code, where I may send a redirect, and then I am done. Is there
> a pseudo exit, or return command?
> 
> brian
> -- 
> Brian Lavender
> http://www.brie.com/brian/

-- 
Brian Lavender
http://www.brie.com/brian/



Lock block problem with Apache::Session::Oracle

2002-04-18 Thread Brian Lavender

I have Apache::Session::Oracle running. It creates the session fine, but
after accessing the page successfully a few times, the script gets held
up waiting for a lock to release and page never loads until I restart
Apache. Here is the sample code I am using. Is there something I need to
do with Apache::Session::Oracle, so it will release a lock it creates.
I am not that familiar with how locks are created in Oracle, but my DBA
took a look at the database, and said that there were some stale locks. I
can run Apache::Session::Oracle under CGI without a problem. Any tips?

brian

use strict;
use Apache;
use DBI ();
use CGI qw(:standard);
use vars qw($DBH);
use Apache::Session::Oracle;

use constant DB => 'DBI:Oracle:foo';
use constant DBAUTH => ':';
use constant EXPIRE => 3;  # allow 3 days before expiration
use constant COOKIE_NAME => 'Session1';

my $r = Apache->request();

$r->status(200);
$r->content_type("text/html");


# Open the database
$DBH ||= DBI->connect(DB, split(':', DBAUTH, 2), {PrintError => 0}) 
|| die "Couldn't open database: ", $DBI::errstr;


my $session_id = cookie(COOKIE_NAME) unless param('new');

$session_id = $session_id ? $session_id : undef;

my %session;

tie %session, 'Apache::Session::Oracle', 
  $session_id,
  {Handle => $DBH };


my $input = param('input');
$session{name} = $input if $input;

print header(-Cookie  => [cookie(-name=> COOKIE_NAME,
 -value   => $session{_session_id},
 -expires => '+' . EXPIRE . 'd'),
cookie(-name=> 'sessionID',
 -value   => 'no longer valid',
 -expires => '-1d')
]
  ),
  start_html(-Title   => 'Hangman 7',
   -bgcolor => 'white');

print<<__EOS__;

Hello
Session ID number is: $session{_session_id}
The Session ID is embedded in the URL

Your input to the form was: $input
Your name is $session{name}


http://penguin:8080/perl/example_db.perl";>Reload this session
http://penguin:8080/perl/example_db.perl?new=1";>New session

http://penguin:8080/perl/example_db.perl"; method="post">
  Type in your name here:
  
  

__EOS__

print end_html;

-- 
Brian Lavender
http://www.brie.com/brian/