Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > DBIx::Simple, authentication fails

Reply
Thread Tools

DBIx::Simple, authentication fails

 
 
Justin Catterall
Guest
Posts: n/a
 
      06-27-2007

I have the following code to connect to a database:

#!/usr/bin/perl

use warnings ;
use strict ;
use DBIx::Simple ;
use SQL::Abstract ;
use CGI qw/:standard/ ;
use CGI::Carp qw/fatalsToBrowser/ ;

my $dataSource ;

db_connect() ;

print "Connected\n";

sub db_connect {
my $user = "name" ;
my $password = "password" ;
my $dataSource = DBIx::Simple->connect(
'dbig:database=prospects', $user, $password,
{ RaiseError => 1 , AutoCommit => 0 }
) or die DBI::Simple->error ;
}

If I run this from the command line "Connected" gets printed. If I run
it from a browser I get:

DBI connect('database=prospects','justin',...) failed: FATAL: Ident
authentication failed for user "justin" at
/var/www/inhouse/prospects/demo.cgi line 22

Does anyone know why this should be?

Thank you for your comments and suggestions.
--
Justin C, by the sea.
 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      06-27-2007
On Jun 27, 9:40 am, Justin Catterall <(E-Mail Removed)> wrote:
> I have the following code to connect to a database:


<snip>

> If I run this from the command line "Connected" gets printed. If I run
> it from a browser I get:
>
> DBI connect('database=prospects','justin',...) failed: FATAL: Ident
> authentication failed for user "justin" at
> /var/www/inhouse/prospects/demo.cgi line 22
>
> Does anyone know why this should be?


The user you're logged in as on the command line has access to the
database. The user your webserver is running as does not.

Fix the access permissions to your database.

See also:
$ perldoc -q 500
Found in /software/perl-5.8.5-0/pkg/lib/5.8.5/pod/perlfaq9.pod
My CGI script runs from the command line but not the
browser. (500 Server Error)


Paul Lalli

 
Reply With Quote
 
 
 
 
Justin C
Guest
Posts: n/a
 
      06-27-2007
On 2007-06-27, Paul Lalli <(E-Mail Removed)> wrote:
> On Jun 27, 9:40 am, Justin Catterall <(E-Mail Removed)> wrote:
>> I have the following code to connect to a database:

>
><snip>
>
>> If I run this from the command line "Connected" gets printed. If I run
>> it from a browser I get:
>>
>> DBI connect('database=prospects','justin',...) failed: FATAL: Ident
>> authentication failed for user "justin" at
>> /var/www/inhouse/prospects/demo.cgi line 22
>>
>> Does anyone know why this should be?

>
> The user you're logged in as on the command line has access to the
> database. The user your webserver is running as does not.
>
> Fix the access permissions to your database.
>
> See also:
> $ perldoc -q 500
> Found in /software/perl-5.8.5-0/pkg/lib/5.8.5/pod/perlfaq9.pod
> My CGI script runs from the command line but not the
> browser. (500 Server Error)


Thank you Paul, adding www-data to the list of database users fixed
this.

Justin.

--
Justin Catterall www.masonsmusic.co.uk
Director T: +44 (0)1424 427562
Masons Music Ltd F: +44 (0)1424 434362
For full company details see our web site
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Active Directory LDAP Authentication Fails in IIS 6 P Webster ASP .Net 2 03-25-2006 02:48 PM
Constant.t fails 240 of 272 tests and recurs.t fails 1 of 25 tests on HPUX using perl 5.8.7 dayo Perl Misc 11 12-16-2005 09:09 PM
LDAP authentication fails with the final release version of ASP.Ne =?Utf-8?B?cmFqZW5zMDA=?= ASP .Net 1 11-08-2005 06:40 AM
slideshow fails, Firefox debugger also fails lkrubner@geocities.com Javascript 2 12-23-2004 06:22 PM
Forms Authentication Fails Between ASP.NET 1.0 and 1.1 Applications (Cookie Decryption Fails) John Saunders ASP .Net 1 11-18-2003 03:25 PM



Advertisments