Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: DBI Problem

by hippo (Bishop)
on Sep 29, 2017 at 08:07 UTC ( [id://1200366]=note: print w/replies, xml ) Need Help??


in reply to DBI Problem

You are not using placeholders, so without seeing the data who knows what the query is actually doing?

Given previous wild goose chases, please provide an SSCCE to avoid such waste this time around. Thanks.

Replies are listed 'Best First'.
Re^2: DBI Problem
by tultalk (Monk) on Sep 29, 2017 at 11:38 UTC

    You say: You are not using placeholders, so without seeing the data who knows what the query is actually doing?

    The code for the query:

    my $statement = "update $sql_user_table set $passpart $mailpart $secre +tpart $wherepart"; $SQL = qq| $statement |; warn ("SQL Statement: '$statement'"); $sth = ExecuteQuery($SQL);

    The error log shows: Fri Sep 29 05:59:35 2017 manage_users.cgi: SQL Statement: 'update users set password = 'briddle' where id = '428'' at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 656.

    Thar error log entry shows what the data was.

Re^2: DBI Problem
by tultalk (Monk) on Sep 29, 2017 at 12:05 UTC

    please provide an SSCCE to avoid such waste this time around

    I tried that with previous problems. When I tried to reduce to a small block of code the problems disappeared so it was not an example. And IIRC I just struggled through until stumbling on solution.

    The error message is pretty clear but I don't understand how to solve it.

    Fri Sep 29 05:59:36 2017 manage_users.cgi: (in cleanup) Can't connect to data source '' 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 /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 26

    I guess that message is coming from DBI.pm..

    # extract dbi:driver prefix from $dsn into $1 $dsn =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i or '' =~ /()/; # ensure $1 etc are empty if match fails my $driver_attrib_spec = $2 || ''; # Set $driver. Old style driver, if specified, overrides new dsn s +tyle. $driver = $old_driver || $1 || $ENV{DBI_DRIVER} or Carp::croak("Can't connect to data source '$dsn' " ."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)");
      When I tried to reduce to a small block of code the problems disappeared so it was not an example.

      That's precisely the point. If you cannot provide an SSCCE because the problem disappears then the problem is with your code and not with anything else.

      Your code is somehow (perhaps indirectly) calling DBI->connect without a proper DSN. That is the issue - it's up to you to find out where in your code this is occuring and fix it there.

        Exactly. That is what I am trying to do and have been for many hours.

        I thought I would ask here since someone might have some insight into this problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1200366]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-23 15:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found