Héctor,
If you are using Windows you should have MySQL ODBC driver installed .
Here is an example that use for via connection.
my $dbh = DBI->connect("dbi:mysql:host=yourhostname:yourdatabase",
"yourusername", "yourpassword )
or die "Can't connect to MySQL database: $DBI::errstr\n";
$sth = $dbh->prepare("INSERT INTO yourdatabase
(col1,col2,col3)
VALUES ('$a','$b','$c')");
$sth->execute();
Regards,
Hung Tran
-----Original Message-----
From: Héctor S. Mendoza O. [mailto:hector@stripped]
Sent: Tuesday, May 16, 2006 10:19 PM
To: perl@stripped
Subject: Problem connecting
Hello everybody!
I have a problem, I wrote a program in perl and I can't connect to the
database, then I try connecting via mysql command and it works fine...
Here is the script.
$db="planos";
$host="localhost";
$userid="web";
$passwd="secret";
$connectionInfo="dbi:mysql:$db;$host";
$dbh = DBI->connect($connectionInfo,$userid,$passwd) or die print "Error
connecting\n\n\n";
And I get
DBI connect('planos;localhost','web',...) failed: Access denied for user
'web'@'localhost' (using password: YES) at ./planos.pl line 25
I use:
mysql -u web -h localhost -p planos
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 38 to server version: 4.1.10a-Max-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
and I get in ok! Any ideas?
TIA
Héctor S. Mendoza Ortiz
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=1