List:General Discussion« Previous MessageNext Message »
From:John Doe Date:February 27 2005 11:42pm
Subject:Re: insert data
View as plain text  
Am Sonntag, 27. Februar 2005 22.19 schrieb Gerald Preston:

Hi Gerald

> The object used:
>
>   my $dbh=DBI->connect( 'DBI:mysql:database=club', 'xxx, 'xxxxx', {
> PrintError => 0} ) or die $DBI::errstr;

I didn't see this part in your first post :-)

Hmm... I've never seen a '=' in the first argument passed to DBI-connect...

Here's an functional example I'm using:

my $db ='database';
my $host ='hostname';
my $port ='1234';
$dbh=DBI->connect("DBI:mysql:$db:$host:$port",
     'a_username',
     'a_password',
     {RaiseError=>1,   
     AutoCommit=>1}) 
    or die "$0: $DBI::errstr"; }


So, try using "club" instead of "database=club", and a hostname too.

greetings joe


[nothing new below]

> -----Original Message-----
> From: John Doe [mailto:security.department@stripped]
> Sent: Sunday, February 27, 2005 6:37 AM
> To: mysql@stripped
> Subject: Re: insert data
>
> Hi Gerald
>
> > I am trying to insert data for the first time using MySQL.  In Oracle I
> > used the following:
> >
> > #  my $sql = "insert into bar( group_name, me, daily, item, unit, qty,
> > amount, tax, total )
> >
> > #                      values( ?,          ?,  ?,     ?,    ?,    ?,   ?,
> > ?,   ? ) ";
> >   my $sth = $dbh->prepare( $sql );
> >   die $dbh->errstr if $dbh->err;
> >   $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, $amount,
> > $tax, $total ) || die "Cannot execute FIRST Statement!!\n$DBI::errstr";
> >
> >
> > I keep getting "Can't call method "prepare" on an un undefined value. 
> > All the name listed are correct by looking at MySQLAdmin1.3\4.
>
> Apart from David Logan's answer:
>
> You have to create the $dbh object first (man DBI); the "undefined value"
> in
>
> the error message refers to that.
>
>
> HTH
>
> joe
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
Thread
insert dataGerald Preston27 Feb
  • Re: insert dataJohn Doe27 Feb
    • RE: insert dataGerald Preston27 Feb
      • Re: insert dataJohn Doe28 Feb
        • Re: insert dataMichael Stassen28 Feb
        • Re: insert dataMichael Stassen28 Feb
          • RE: insert dataGerald Preston28 Feb
            • RE: insert dataWilliam R. Mussatto28 Feb
              • RE: insert dataGerald Preston1 Mar
            • Re: insert dataEamon Daly28 Feb
            • Re: insert dataJohn Doe1 Mar
RE: insert dataSST - Adelaide)27 Feb
  • RE: insert dataGerald Preston27 Feb
    • RE: insert dataGerald Preston27 Feb
      • RE: insert dataPaul DuBois27 Feb
RE: insert dataSST - Adelaide)27 Feb
  • RE: insert dataGerald Preston27 Feb
RE: insert dataSST - Adelaide)27 Feb
  • RE: insert dataGerald Preston27 Feb
RE: insert dataSST - Adelaide)27 Feb
RE: insert dataSST - Adelaide)1 Mar
  • RE: insert dataGerald Preston4 Mar
    • Re: insert dataRoger Baklund4 Mar
    • Re: insert dataMichael Stassen4 Mar
RE: insert dataJohn Trammell4 Mar
Re: insert dataMichael Stassen5 Mar
  • RE: insert dataGerald Preston5 Mar