Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: (mysql) failing to locate object method

by davorg (Chancellor)
on Aug 03, 2004 at 08:47 UTC ( [id://379555]=note: print w/replies, xml ) Need Help??


in reply to (mysql) failing to locate object method

Can we see the code? It's hard to debug stuff via telepathy. Currently my money would be on you not loading the DBI module in the program (like the error message suggests).

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

  • Comment on Re: (mysql) failing to locate object method

Replies are listed 'Best First'.
Re^2: (mysql) failing to locate object method
by sriraj (Initiate) on Aug 03, 2004 at 08:56 UTC
    hi davorg

    thanks for immediate response and here the code which i am trying

    to execute,kindly help me

    use DBI; # Here's how to include the DBI module my $dbh; my $db = 'myfirstdatabase'; my $db_user = 'RAM'; my $db_password = ''; # Connect to the requested server $dbh = DBI->connect ("dbi:mysql:$db","$db_user", "$db_password",{Raise +Error => 0, PrintError => 0} ) or err_trap("Cannot connect to the dat +abase"); my $sql; my $sth; $sql = "SELECT max(unxtmstmp) FROM logfl"; $sth=$dbh->prepare($sql) or die "preparing: ",$dbh->errstr; $sth->execute or die "executing: ", $dbh->errstr; @$d = $sth->fetchrow_array; print "@$d";
      This program works for me, once I change $db, $db_user, $db_password, and $sql to something that exists on my system. Also I had to add a subroutine for err_trap(). Do you have the DBD::mysql module installed?
        hi davorge

        i installed all the modules which u had mentioned and even now when i am

        trying to install i am getting this message

        C:\>ppm

        PPM - Programmer's Package Manager version 3.1.

        Copyright (c) 2001 ActiveState SRL. All Rights Reserved.

        Entering interactive shell. Using Term::ReadLine::Stub as readline library.

        Type 'help' to get started.

        ppm> install dbi

        Note: Package 'DBI' is already installed.

        ppm> install dbd-mysql

        Note: Package 'DBD-mysql' is already installed.

        ppm>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-25 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found