rammoorthi has asked for the wisdom of the Perl Monks concerning the following question:
I create a new database in MySQL and connecting it using Perl.But i am getting "unable to connect database" error. If i connect the default database available in the MySQL(default during the installation) then the program working fine. Can any one help me regarding this.
#!/usr/local/bin/perl use DBI; $dbh = DBI->connect('dbi:mysql:ram','root','root') or die "Connection Error: $DBI::errstr\n"; $sql = "select * from test1"; $sth = $dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while (@row = $sth->fetchrow_array) { print "@row\n"; }
error: DBI connect('ram','root',...) failed: Unknown database 'ram' at C:\Documents and Settings\Admin\Desktop\test.pl line 3 Connection Error: Unknown database 'ram'
Thanks in advance
Ram
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unable to connect new database in mysql
by kcott (Archbishop) on Aug 10, 2011 at 05:50 UTC | |
by rammoorthi (Novice) on Aug 10, 2011 at 07:50 UTC | |
by cjb (Friar) on Aug 10, 2011 at 11:41 UTC | |
by rammoorthi (Novice) on Aug 10, 2011 at 12:40 UTC | |
|
Re: unable to connect new database in mysql
by fisher (Priest) on Aug 10, 2011 at 08:50 UTC | |
by rammoorthi (Novice) on Aug 10, 2011 at 09:41 UTC |