monkfan has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
Why was my script below:
Regards,
Edward
Why was my script below:
Giving such error messageuse strict; use Data::Dumper; use Carp; use DBI; my $dsn = 'localhost'; my $user = 'monkfan'; my $password = 'monkfan'; my $dbh = DBI->connect('dbi:mysql:motif_finder','monkfan','monkpwd') or die "Connection Error: $DBI::errstr\n"; my $sql = "SELECT Symbol FROM gene2go WHERE GeneID=812222"; my $sth = $dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while ( my @row = $sth->fetchrow_array ) { print "@row\n"; }
Even though it is clearly shown in the SQL query below which is equivalent to above Perl script, is actually working?:!perl test_dbi.pl + DBD::mysql::st execute failed: Unknown column 'Symbol' in 'field list' + at test_dbi.pl line 21. SQL Error: Unknown column 'Symbol' in 'field list'
mysql> select Symbol from gene_info where GeneID = "812222"; +-----------+ | Symbol | +-----------+ | PF14_0640 | +-----------+ 1 row in set (13.06 sec) mysql> show tables; +------------------------+ | Tables_in_motif_finder | +------------------------+ | gene2go | | gene_info | +------------------------+ 2 rows in set (0.00 sec) mysql> show databases; +--------------+ | Database | +--------------+ | motif_finder | +--------------+ 1 rows in set (0.00 sec)
Regards,
Edward
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Failure to Recognize Field in DBI MySQL access
by ikegami (Patriarch) on Apr 22, 2007 at 14:43 UTC | |
Re: Failure to Recognize Field in DBI MySQL access
by CountZero (Bishop) on Apr 22, 2007 at 16:40 UTC |
Back to
Seekers of Perl Wisdom