Help for a DBI newbie

Help for a DBI newbie

am 09.12.2005 21:31:36 von Mike Burbey

I am trying to connect to a mysql server running on the same PC that I
am running this script from.

use strict;
use DBI;

my $dbh = DBI->("DBD:mysql:database=FLS;host=localhost", "burbey",
"civic1", {'RaiseError' => 1});
------------------------------------------------------------ -------
This is the error I receive when trying to run this 1 line of code:
Undefined subroutine &main::DBI called at testdb.pl line 4.

Using CPAN this shows both the DBI and DBD:mysql modules are installed:
cpan> install DBI
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Fri, 09 Dec 2005 10:08:29 GMT
DBI is up to date.
cpan> install DBD::mysql
DBD::mysql is up to date.




--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Help for a DBI newbie

am 09.12.2005 21:40:26 von Paul DuBois

At 20:31 +0000 12/9/05, Mike Burbey wrote:
>I am trying to connect to a mysql server running on the same PC that I
>am running this script from.
>
>use strict;
>use DBI;
>
>my $dbh = DBI->("DBD:mysql:database=FLS;host=localhost", "burbey",
>"civic1", {'RaiseError' => 1});
>----------------------------------------------------------- --------
>This is the error I receive when trying to run this 1 line of code:
>Undefined subroutine &main::DBI called at testdb.pl line 4.

You want DBI->connect(), not DBI->().

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: Help for a DBI newbie

am 09.12.2005 21:40:36 von Shlomi Zlatopolsky

--Boundary_(ID_oRe3vivjzeq5gojoglq9jA)
Content-type: text/plain; charset=Windows-1252
Content-transfer-encoding: 7BIT

Missing ``connect''

Your connection string will be:

my $dbh = DBI->connect("DBD:mysql:database=FLS;host=localhost",
"burbey", "civic1", 'RaiseError' => 1});



-----Original Message-----
From: Mike Burbey [mailto:burbey@new.rr.com]
Sent: Friday, December 09, 2005 10:32 PM
To: msql-mysql-modules@lists.mysql.com
Subject: Help for a DBI newbie



I am trying to connect to a mysql server running on the same PC that I

am running this script from.



use strict;

use DBI;



my $dbh = DBI->("DBD:mysql:database=FLS;host=localhost", "burbey",

"civic1", {'RaiseError' => 1});

------------------------------------------------------------ -------

This is the error I receive when trying to run this 1 line of code:

Undefined subroutine &main::DBI called at testdb.pl line 4.



Using CPAN this shows both the DBI and DBD:mysql modules are installed:

cpan> install DBI

CPAN: Storable loaded ok

Going to read /root/.cpan/Metadata

Database was generated on Fri, 09 Dec 2005 10:08:29 GMT

DBI is up to date.

cpan> install DBD::mysql

DBD::mysql is up to date.









--

MySQL Perl Mailing List

For list archives: http://lists.mysql.com/perl

To unsubscribe:
http://lists.mysql.com/perl?unsub=zlatopol@netvision.net.il





--

No virus found in this incoming message.

Checked by AVG Free Edition.

Version: 7.1.371 / Virus Database: 267.13.13/197 - Release Date: 09.12.2005




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.13/197 - Release Date: 09.12.2005


--Boundary_(ID_oRe3vivjzeq5gojoglq9jA)--

Re: Help for a DBI newbie

am 09.12.2005 21:41:08 von Greg Meckes

Just a stab but it's perhaps the path to perl? Maybe the CPAN module is installing it a different
location that what you are calling from your script?



--- Mike Burbey wrote:

> I am trying to connect to a mysql server running on the same PC that I
> am running this script from.
>
> use strict;
> use DBI;
>
> my $dbh = DBI->("DBD:mysql:database=FLS;host=localhost", "burbey",
> "civic1", {'RaiseError' => 1});
> ------------------------------------------------------------ -------
> This is the error I receive when trying to run this 1 line of code:
> Undefined subroutine &main::DBI called at testdb.pl line 4.
>
> Using CPAN this shows both the DBI and DBD:mysql modules are installed:
> cpan> install DBI
> CPAN: Storable loaded ok
> Going to read /root/.cpan/Metadata
> Database was generated on Fri, 09 Dec 2005 10:08:29 GMT
> DBI is up to date.
> cpan> install DBD::mysql
> DBD::mysql is up to date.
>
>
>
>
> --
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe: http://lists.mysql.com/perl?unsub=gregmeckes@yahoo.com
>
>


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Help for a DBI newbie

am 09.12.2005 21:42:22 von Greg Meckes

Oh yeah, you'll need the "connect" statement first also.


--- Mike Burbey wrote:

> I am trying to connect to a mysql server running on the same PC that I
> am running this script from.
>
> use strict;
> use DBI;
>
> my $dbh = DBI->("DBD:mysql:database=FLS;host=localhost", "burbey",
> "civic1", {'RaiseError' => 1});
> ------------------------------------------------------------ -------
> This is the error I receive when trying to run this 1 line of code:
> Undefined subroutine &main::DBI called at testdb.pl line 4.
>
> Using CPAN this shows both the DBI and DBD:mysql modules are installed:
> cpan> install DBI
> CPAN: Storable loaded ok
> Going to read /root/.cpan/Metadata
> Database was generated on Fri, 09 Dec 2005 10:08:29 GMT
> DBI is up to date.
> cpan> install DBD::mysql
> DBD::mysql is up to date.
>
>
>
>
> --
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe: http://lists.mysql.com/perl?unsub=gregmeckes@yahoo.com
>
>


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org