Can't locate object method connect via package DBI

View: New views
7 Messages — Rating Filter:   Alert me  

Can't locate object method connect via package DBI

by sdstein7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am in the midst of a struggle to install Koha on a Red Hat Linux 5.3 system.  I am on the last page of the Fedora INSTALL instructions, and getting the following error:

"Can't locate object method "connect" via package "DBI" in /usr/share/koha/lib/C4/Context.pm line 666"

Here is Context.pm line 666:
my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
        $db_user, $db_passwd) or die $DBI::errstr;

I get the same error in two places:
1.  Running zebraqueue_daemon.pl
2.  Trying to connect to Koha using http://localhost/phpmyadmin

I am certain that DBI is installed (although it took a force install in CPAN), that the DBI directory and DBI.pm are in the Perl @INC path, and that the 'use DBI' statement is present in Context.pm.

I am certain that all the variables in line 666 are defined.  I also wrote a very simple perl script to call
DBI->connect and it failed in the same way.

Any help is greatly appreciated.

Thanks,
Sanford Stein


Re: Can't locate object method connect via package DBI

by Magnus Enger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Could it be that you are missing DBD::mysql - the DBI "driver" for
MySQL? Just a hunch...

Regards,
Magnus Enger
http://libriotech.no/

2009/7/2 sdstein7 <sdstein7@...>:

>
> I am in the midst of a struggle to install Koha on a Red Hat Linux 5.3
> system.  I am on the last page of the Fedora INSTALL instructions, and
> getting the following error:
>
> "Can't locate object method "connect" via package "DBI" in
> /usr/share/koha/lib/C4/Context.pm line 666"
>
> Here is Context.pm line 666:
> my $dbh=
> DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
>        $db_user, $db_passwd) or die $DBI::errstr;
>
> I get the same error in two places:
> 1.  Running zebraqueue_daemon.pl
> 2.  Trying to connect to Koha using http://localhost/phpmyadmin
>
> I am certain that DBI is installed (although it took a force install in
> CPAN), that the DBI directory and DBI.pm are in the Perl @INC path, and that
> the 'use DBI' statement is present in Context.pm.
>
> I am certain that all the variables in line 666 are defined.  I also wrote a
> very simple perl script to call
> DBI->connect and it failed in the same way.
>
> Any help is greatly appreciated.
>
> Thanks,
> Sanford Stein
>
>
> --
> View this message in context: http://www.nabble.com/Can%27t-locate-object-method-connect-via-package-DBI-tp24310000p24310000.html
> Sent from the Koha - Discuss mailing list archive at Nabble.com.
>
> _______________________________________________
> Koha mailing list
> Koha@...
> http://lists.katipo.co.nz/mailman/listinfo/koha
>
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Can't locate object method connect via package DBI

by Rick Welykochy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Magnus Enger wrote:

> Could it be that you are missing DBD::mysql - the DBI "driver" for
> MySQL? Just a hunch...


Check that DBI is installed:

perldoc DBI

and

perldoc -l DBI

shows you where it is installed.

Then do the same for the mysql driver:

perldoc DBD::mysql
perldoc -l DBD::mysql


>> I also wrote a
>> very simple perl script to call
>> DBI->connect and it failed in the same way.

Highly recommended. Get your simple script working first.
Then tackle the bigger picture.


cheers
rickw



--
_________________________________
Rick Welykochy || Praxis Services

"Yes means No and No means Yes. Delete all files [Y]? "
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Can't locate object method connect via package DBI

by Joe Atzberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No, everything is installed or you would get a different error. 

The mysql account in your koha-conf.xml file is wrong or not granted permissions. 

Try connecting using mysql on the command line and the info form your file.  When that fails, go back and do the "grant..." steps in the install, like:

grant all on <kohadatabasename>.* to '<kohadatabaseuser>'@'localhost' identified by '<kohadatabaseuserpassword>';


--
Joe Atzberger
LibLime - Open Source Library Solutions


On Thu, Jul 2, 2009 at 12:37 PM, sdstein7 <sdstein7@...> wrote:

I am in the midst of a struggle to install Koha on a Red Hat Linux 5.3
system.  I am on the last page of the Fedora INSTALL instructions, and
getting the following error:

"Can't locate object method "connect" via package "DBI" in
/usr/share/koha/lib/C4/Context.pm line 666"

Here is Context.pm line 666:
my $dbh=
DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
       $db_user, $db_passwd) or die $DBI::errstr;

I get the same error in two places:
1.  Running zebraqueue_daemon.pl
2.  Trying to connect to Koha using http://localhost/phpmyadmin

I am certain that DBI is installed (although it took a force install in
CPAN), that the DBI directory and DBI.pm are in the Perl @INC path, and that
the 'use DBI' statement is present in Context.pm.

I am certain that all the variables in line 666 are defined.  I also wrote a
very simple perl script to call
DBI->connect and it failed in the same way.

Any help is greatly appreciated.

Thanks,
Sanford Stein


--
View this message in context: http://www.nabble.com/Can%27t-locate-object-method-connect-via-package-DBI-tp24310000p24310000.html
Sent from the Koha - Discuss mailing list archive at Nabble.com.

_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha


_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Can't locate object method connect via package DBI

by sdstein7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks to everyone for your responses.

Marcus and Rick, DBI and DBD::mysql are definitely installed:

[root@olive]# perldoc -l DBI
/usr/local/lib/perl5/5.8.9/DBI.pm
[root@olive]# perldoc -l DBD::mysql
/usr/local/lib/perl5/site_perl/5.8.9/i686-linux/DBD/mysql.pm
[root@olive]# perl showperlinc.pl
/usr/share/koha/lib
/usr/local/lib/perl5/5.8.9/i686-linux
/usr/local/lib/perl5/5.8.9
/usr/local/lib/perl5/site_perl/5.8.9/i686-linux
/usr/local/lib/perl5/site_perl/5.8.9

Joe, I had already confirmed that I could get into mysql from the shell prompt using the same user/password that was generating the error.  But per your suggestion I went into mysql as root and did a 'grant all' to this user.  Then I tried to connect via my browser, and run zebraqueue_daemon, and the same error was still present in both cases.

If it helps, here is the statement I am using in my small test script:
$dbh = DBI->connect("DBI:mysql:koha","<username>","<password>")

 

Re: Can't locate object method connect via package DBI

by Joe Atzberger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If it helps, here is the statement I am using in my small test script:
$dbh = DBI->connect("DBI:mysql:koha","<username>","<password>")

I assume you are using a real username in place of <username> and a real password in place of <password>, and the matching values in the GRANT commands.

If you can connect on command line, as you suggest, then please also test some critical operations like create a new table and then deleting it.  Those are the kinds of permissions that your Koha user needs to have at installation.  Getting in is not enough.

The exact statement Koha uses is:
    my $dbh= DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port", $db_user, $db_passwd);

All the strings with dollar signs ($) prepended are variables populated with values from the bottom of koha-conf.xml. 

Make sure your Apache VirtualHost config uses SetEnv KOHA_CONF ... with the correct path to your koha-conf.xml file.  This should be the same file path you reference in shell by saying something like:

export KOHA_CONF=/path/to/my/koha-conf.xml

Otherwise you are testing something different than Apache is seeing.  If you edited the Apache configs at all, remember to do a (graceful) restart to make them take effect.

--Joe

_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: Can't locate object method connect via package DBI

by sdstein7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe,

Thanks for your followup.  Please see my responses below labeled "SS":
Joe Atzberger wrote:
>
> If it helps, here is the statement I am using in my small test script:
> $dbh = DBI->connect("DBI:mysql:koha","<username>","<password>")
>

I assume you are using a real username in place of <username> and a real
password in place of <password>, and the matching values in the GRANT
commands.

      SS:  Yes, I am using a real username and password.  The username matches the value in the GRANT
             command.  The GRANT command does not ask for a password, but I am using the one assigned
             when I created the account, and I can login to mysql using that password.

If you can connect on command line, as you suggest, then please also test
some critical operations like create a new table and then deleting it.
Those are the kinds of permissions that your Koha user needs to have at
installation.  Getting in is not enough.

      SS:  Yes, I can create tables, insert values, select values, delete values, drop tables, etc.

The exact statement Koha uses is:
    my $dbh=
DBI->connect("DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
$db_user, $db_passwd);


All the strings with dollar signs ($) prepended are variables populated with
values from the bottom of koha-conf.xml.

      SS:  The code pulls the values from context->config, which I assume get its values from
             from koha-conf.xml.  The values in koha-conf.xml are correct for hostname, database, port, user
             and pass.

Make sure your Apache VirtualHost config uses SetEnv KOHA_CONF ... with the
correct path to your koha-conf.xml file.  This should be the same file path
you reference in shell by saying something like:

export KOHA_CONF=/path/to/my/koha-conf.xml

Otherwise you are testing something different than Apache is seeing.  If you
edited the Apache configs at all, remember to do a (graceful) restart to
make them take effect.

      SS:  SetEnv KOHA_CONF is correct in the <VIrtualHost> section of httpd.conf.
             After making this change, I rebooted the server.

--Joe

      SS:  If you have any other suggestions, they are greately appreciated.

_______________________________________________
Koha mailing list
Koha@lists.katipo.co.nz
http://lists.katipo.co.nz/mailman/listinfo/koha