Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

DBI SQLite driver missing after Catalyst update.

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


ccondray at gmail

Aug 19, 2009, 8:42 PM

Post #1 of 7 (1395 views)
Permalink
DBI SQLite driver missing after Catalyst update.

I have recently updated my Catalyst installation from 5.71001 to version
5.80007 and have made one of my websites completely unusable. I followed the
instructions in the tutorial (
http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod)
to update the database to use load_components and have updated my schema
files to match. However, when I go to my site I get the following error
message:

DBIx::Class::ResultSet::next(): DBI Connection failed: Can't connect to data
source 'HASH(0x9e139e0)' because I can't work out what driver to use (it
doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is
not set) at /home/me/local/share/perl/5.8.4/DBIx/Class/Storage/DBI.pm line
840

My connection string looks OK and matches the tutorial's example code:

__PACKAGE__->config(
schema_class => 'wppig::Schema',
connect_info => [
'dbi:SQLite:wppig.db3',
],
);

Debugging says the piece of code that it's hanging on looks like this:

my $result = $c->model('DB::Result::Tag')->search(
{ },
{ join => { 'items_tag' => 'tag' } }
);

while ( my $tag = $result->next ) { # Hangs here
$tag_count{ $tag->tag }++;
}

So it looks like the class is loading but I can't do anything with the
ResultSet.

Any idea of why this is failing? Did I miss a step somewhere in the
conversion? I'd be happy to provide more information if needed.

Thanks in advance for your help.

Collin Condray
@ccondray
condray.net


bobtfish at bobtfish

Aug 20, 2009, 12:44 AM

Post #2 of 7 (1305 views)
Permalink
Re: DBI SQLite driver missing after Catalyst update. [In reply to]

On 20 Aug 2009, at 04:42, Collin Condray wrote:

> I have recently updated my Catalyst installation from 5.71001 to
> version 5.80007 and have made one of my websites completely unusable.

But you've got the old code in revision control, right? And you're
deploying a tagged version, so this isn't an issue for your actual
'production' site?

> I followed the instructions in the tutorial (http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod
> ) to update the database to use load_components and have updated my
> schema files to match. However, when I go to my site I get the
> following error message:

Erm, this is the tutorial for building a new application, it has
nothing to do with updating your app.

You don't need to 'upgrade' the layout of your DBIC schema classes in
any way to be compatible with 5.80, or with the latest DBIC.

>
> while ( my $tag = $result->next ) { # Hangs here

That'll be the point at which DBIC first executes the query.

On a tangential note, putting this much logic into your Catalyst
controller is not recommended - this would be better implemented as a
method on your ResultSet class.

> Any idea of why this is failing? Did I miss a step somewhere in the
> conversion? I'd be happy to provide more information if needed.

Nope. I'd start by turning DBIC_TRACE on to get extra debugging (which
may reveal something), and then asking the DBIC list - this isn't
anything to do with Catalyst, so you're much more likely to get help
over there.

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


ccondray at gmail

Aug 20, 2009, 10:25 AM

Post #3 of 7 (1289 views)
Permalink
DBI SQLite driver missing after Catalyst update. [In reply to]

Tom thanks for your response.

>> I have recently updated my Catalyst installation from 5.71001 to
>> version 5.80007 and have made one of my websites completely unusable.
>
>But you've got the old code in revision control, right? And you're
>deploying a tagged version, so this isn't an issue for your actual
>'production' site?

Yes, everything is under version control, but the original code I had and
the tutorial modified code. When I updated Catalyst it affected both
development and production sites and I'm getting the same missing driver
error message which I wasn't getting before upgrading.

>> I followed the instructions in the tutorial (
http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod
>> ) to update the database to use load_components and have updated my
>> schema files to match. However, when I go to my site I get the
>> following error message:
>
>Erm, this is the tutorial for building a new application, it has
>nothing to do with updating your app.
>
>You don't need to 'upgrade' the layout of your DBIC schema classes in
>any way to be compatible with 5.80, or with the latest DBIC.

The schema that that I had using the older load_classes method and the
schema using the recommended load_namespaces method are returning the same
missing driver error so I'm not sure that this is the source of the problem.

>>
>> while ( my $tag = $result->next ) { # Hangs here
>
>That'll be the point at which DBIC first executes the query.

I forgot about that, that makes sense.

>
>On a tangential note, putting this much logic into your Catalyst
>controller is not recommended - this would be better implemented as a
>method on your ResultSet class.

Thanks for the tip. I just learned about it when reading the updated
tutorial. I'll start using this method as soon as I can.

>
>> Any idea of why this is failing? Did I miss a step somewhere in the
>> conversion? I'd be happy to provide more information if needed.
>
>Nope. I'd start by turning DBIC_TRACE on to get extra debugging (which
>may reveal something), and then asking the DBIC list - this isn't
>anything to do with Catalyst, so you're much more likely to get help
>over there.

I turned on DBIC_TRACE as you suggested but I still get the same missing
driver errors from my original message. However, when I when do what the
error messages say and set DBI_DRIVER=SQLite and run it, I can see the raw
SQL statements in the error messages. It appears that I have the correct
driver modules installed but Catalyst doesn't know how to load them without
a little help.

Do you still think this is a DBIC error? If not, I'd appreciate any help in
finding where I've done something wrong.

Again, thanks for taking the time to help me with this problem.

>Cheers
>t0m

Collin Condray
@ccondray
condray.net


matt at mattwhipple

Aug 20, 2009, 1:47 PM

Post #4 of 7 (1299 views)
Permalink
Re: DBI SQLite driver missing after Catalyst update. [In reply to]

Collin Condray wrote:
> I have recently updated my Catalyst installation from 5.71001 to
> version 5.80007 and have made one of my websites completely unusable.
> I followed the instructions in the tutorial
> (http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod
> <http://search.cpan.org/%7Ehkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod>)
> to update the database to use load_components and have updated my
> schema files to match. However, when I go to my site I get the
> following error message:
>
> DBIx::Class::ResultSet::next(): DBI Connection failed: Can't connect
> to data source 'HASH(0x9e139e0)' because I can't work out what driver
> to use (it doesn't seem to contain a 'dbi:driver:' prefix and the
> DBI_DRIVER env var is not set) at
> /home/me/local/share/perl/5.8.4/DBIx/Class/Storage/DBI.pm line 840
The error message there would seem to say that the dsn isn't being
retrieved properly out of the config info
>
> My connection string looks OK and matches the tutorial's example code:
>
> __PACKAGE__->config(
> schema_class => 'wppig::Schema',
> connect_info => [
> 'dbi:SQLite:wppig.db3',
> ],
> );
I'd opt for the more explicit and scalable key/value option of:

connect_info => {
dsn => 'dbi:SQLite:wppig.db3',
},


But judging from the docs (which confusing do say arrayref)
http://search.cpan.org:80/~mstrout/Catalyst-Model-DBIC-Schema-0.26/lib/Catalyst/Model/DBIC/Schema.pm#connect_info

I'd say you'd be looking for
connect_info => 'dbi:SQLite:wppig.db3',


As a side not you may want to meditate on the fact that you apparently
simultaneously introduced instability into a development and a
production environment (according to the other reply thread)

>
> Debugging says the piece of code that it's hanging on looks like this:
>
> my $result = $c->model('DB::Result::Tag')->search(
> { },
> { join => { 'items_tag' => 'tag' } }
> );
>
> while ( my $tag = $result->next ) { # Hangs here
> $tag_count{ $tag->tag }++;
> }
>
> So it looks like the class is loading but I can't do anything with the
> ResultSet.
>
> Any idea of why this is failing? Did I miss a step somewhere in the
> conversion? I'd be happy to provide more information if needed.
>
> Thanks in advance for your help.
>
> Collin Condray
> @ccondray
> condray.net <http://condray.net>
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


ccondray at gmail

Aug 20, 2009, 4:04 PM

Post #5 of 7 (1286 views)
Permalink
Re: DBI SQLite driver missing after Catalyst update. [In reply to]

Matt, thanks for helping me out. Comments below:

On Thu, Aug 20, 2009 at 3:47 PM, Matt Whipple <matt [at] mattwhipple> wrote:

> Collin Condray wrote:
>
>> I have recently updated my Catalyst installation from 5.71001 to version
>> 5.80007 and have made one of my websites completely unusable. I followed the
>> instructions in the tutorial (
>> http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod<http://search.cpan.org/%7Ehkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod><
>> http://search.cpan.org/%7Ehkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod>)
>> to update the database to use load_components and have updated my schema
>> files to match. However, when I go to my site I get the following error
>> message:
>>
>> DBIx::Class::ResultSet::next(): DBI Connection failed: Can't connect to
>> data source 'HASH(0x9e139e0)' because I can't work out what driver to use
>> (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env
>> var is not set) at /home/me/local/share/perl/5.8.4/DBIx/Class/Storage/DBI.pm
>> line 840
>>
> The error message there would seem to say that the dsn isn't being
> retrieved properly out of the config info
>

Agreed.


>
>> My connection string looks OK and matches the tutorial's example code:
>>
>> __PACKAGE__->config(
>> schema_class => 'wppig::Schema',
>> connect_info => [
>> 'dbi:SQLite:wppig.db3',
>> ],
>> );
>>
> I'd opt for the more explicit and scalable key/value option of:
>
> connect_info => {
> dsn => 'dbi:SQLite:wppig.db3',
> },
>
>
> But judging from the docs (which confusing do say arrayref)
>
> http://search.cpan.org:80/~mstrout/Catalyst-Model-DBIC-Schema-0.26/lib/Catalyst/Model/DBIC/Schema.pm#connect_info<http://search.cpan.org:80/%7Emstrout/Catalyst-Model-DBIC-Schema-0.26/lib/Catalyst/Model/DBIC/Schema.pm#connect_info>
>
> I'd say you'd be looking for
> connect_info => 'dbi:SQLite:wppig.db3',
>
>
>
I've tried both formulations of the config string

__PACKAGE__->config(
schema_class => 'wppig::Schema',
connect_info => {
dsn => 'dbi:SQLite:wppig.db3',
},
);

__PACKAGE__->config(
schema_class => 'wppig::Schema',
connect_info => 'dbi:SQLite:wppig.db3',
);

and even from the docs that you cite

__PACKAGE__->config(
schema_class => 'wppig::Schema',
connect_info => {
dsn => 'dbi:SQLite:dbname=wppig.db3',
},
);

But I still get the same error message. No matter if I've got a hashref or a
string set for connect_info I still see the "Can't connect to data source
'HASH(0x9e139e0)' " error.

Interestingly, when I remove the connect_info line I see this in the logs:
" Couldn't instantiate component "wppig::Model::wppigDB", Either
->config->{connect_info} must be defined for wppig::Model::wppigDB or
wppig::Schema must have connect info defined on it."

Since the the wppig/Schema.pm file has no config information in it, it must
mean there's probably no other config file squirreled away affecting the
connection.

As a side not you may want to meditate on the fact that you apparently
> simultaneously introduced instability into a development and a production
> environment (according to the other reply thread)
>
>
Guilty as charged, I'll fix it as soon as I can get to it.


>
>> Debugging says the piece of code that it's hanging on looks like this:
>>
>> my $result = $c->model('DB::Result::Tag')->search(
>> { },
>> { join => { 'items_tag' => 'tag' } }
>> );
>>
>> while ( my $tag = $result->next ) { # Hangs here
>> $tag_count{ $tag->tag }++;
>> }
>>
>> So it looks like the class is loading but I can't do anything with the
>> ResultSet.
>>
>> Any idea of why this is failing? Did I miss a step somewhere in the
>> conversion? I'd be happy to provide more information if needed.
>>
>> Thanks in advance for your help.
>>
>> Collin Condray
>> @ccondray
>> condray.net <http://condray.net>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> List: Catalyst [at] lists
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst [at] lists/
>> Dev site: http://dev.catalyst.perl.org/
>>
>>
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>


If there's something else about my app that I can show you to help solve
this problem, please let me know. Thanks again for your help.


Collin Condray
@ccondray
condray.net


matt at mattwhipple

Aug 21, 2009, 5:54 AM

Post #6 of 7 (1264 views)
Permalink
Re: DBI SQLite driver missing after Catalyst update. [In reply to]

>
>
> I've tried both formulations of the config string
>
> __PACKAGE__->config(
> schema_class => 'wppig::Schema',
> connect_info => {
> dsn => 'dbi:SQLite:wppig.db3',
> },
> );
>
> __PACKAGE__->config(
> schema_class => 'wppig::Schema',
> connect_info => 'dbi:SQLite:wppig.db3',
> );
>
> and even from the docs that you cite
>
> __PACKAGE__->config(
> schema_class => 'wppig::Schema',
> connect_info => {
> dsn => 'dbi:SQLite:dbname=wppig.db3',
> },
> );
>
> But I still get the same error message. No matter if I've got a
> hashref or a string set for connect_info I still see the "Can't
> connect to data source 'HASH(0x9e139e0)' " error.
>
> Interestingly, when I remove the connect_info line I see this in the logs:
> " Couldn't instantiate component "wppig::Model::wppigDB", Either
> ->config->{connect_info} must be defined for wppig::Model::wppigDB or
> wppig::Schema must have connect info defined on it."

I'd suggest testing placing the connect_info in the app's config file
(designated for the model), or in the schema file. With the info in the
schema file it isolates the connection within DBIC.

>
> Since the the wppig/Schema.pm file has no config information in it, it
> must mean there's probably no other config file squirreled away
> affecting the connection.
>
> As a side not you may want to meditate on the fact that you
> apparently simultaneously introduced instability into a
> development and a production environment (according to the other
> reply thread)
>
>
> Guilty as charged, I'll fix it as soon as I can get to it.
>
>
>
> Debugging says the piece of code that it's hanging on looks
> like this:
>
> my $result = $c->model('DB::Result::Tag')->search(
> { },
> { join => { 'items_tag' => 'tag' } }
> );
>
> while ( my $tag = $result->next ) { # Hangs here
> $tag_count{ $tag->tag }++;
> }
>
> So it looks like the class is loading but I can't do anything
> with the ResultSet.
>
> Any idea of why this is failing? Did I miss a step somewhere
> in the conversion? I'd be happy to provide more information if
> needed.
>
> Thanks in advance for your help.
>
>
>
> If there's something else about my app that I can show you to help
> solve this problem, please let me know. Thanks again for your help.
>
>
> Collin Condray
> @ccondray
> condray.net <http://condray.net>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


jon at jrock

Aug 21, 2009, 11:47 AM

Post #7 of 7 (1255 views)
Permalink
Re: DBI SQLite driver missing after Catalyst update. [In reply to]

* On Thu, Aug 20 2009, Collin Condray wrote:
> <stuff>

So the debugging technique you should use is to find the message that's
printing HASH(0x123456), and then use DDS or something to actually dump
that hash. (Carp::cluck is also very helpful here.)

Then you can see where you are and what data is there, and then you can
better guess *why* it's there.

Regards,
Jonathan Rockway

--
print just => another => perl => hacker => if $,=$"

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.