[prev in list] [next in list] [prev in thread] [next in thread]
List: dbi-users
Subject: Re: Problem using column_info method and mysql
From: "Martin Gainty" <mgainty () hotmail ! com>
Date: 2008-04-19 0:42:03
Message-ID: BLU142-DAV46C5B2EFC49717740C549AEE70 () phx ! gbl
[Download RAW message or body]
Be sure to specify the $databasemy $dsn='DBI:mysql:$database';Bon
ChanceMartin------ Original Message -----
From: "Denis Sacchet" <denis@sacchet.fr>
To: <dbi-users@perl.org>
Sent: Friday, April 18, 2008 10:24 AM
Subject: Problem using column_info method and mysql
> Hello,
>
> I try to fetch column information from a mysql database, but I got the
> following error :
>
> DBD::mysql::db column_info failed: Incorrect database name '' at
> ./indexes.pl line 17.
>
> Here is the code I use :
>
> #!/usr/bin/perl
>
> use warnings;
> use DBI;
> use strict;
>
> my $dsn='DBI:mysql:xxx:xxx';
> my $dbh= DBI->connect($dsn,"xxx","xxx") or die "Unable to connect to
> database ($DBI::errstr)";
>
> my $sth=$dbh->table_info('','','%','');
>
> while (my @row = $sth->fetchrow_array) {
> my $sth2=$dbh->column_info('',$row[1],$row[2],'%');
> while (my @row2 = $sth2->fetchrow_array) {
> print "@row2";
> }
> }
>
> I try several things on the column_info(), nothing worked, and I found
> nothing on the mailing list.
>
> What do I make wrong ?
>
> I use mysql 5.0.45-1ubuntu3.3 and libdbi-perl 1.57-1 both in the ubuntu
> repositories.
>
> Thanks in advance
>
> Best regards
>
> Denis Sacchet
>
> --
> Denis Sacchet aka. Ouba ("`-/")_.-'"``-._
> . . `; -._ )-;-,_`)
> "Computers are like air conditionners (v_,)' _ )`-.\ ``-'
> They stop working properly when you _.- _..-_/ / ((.'
> open Windows !!!" ((,.-' ((,/
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic