Hello guys..

I am new to Perl and now reached till database concepts in Perl. I am using Wamp server in my computer. Is it possible to connect to the MySQL running in it :-/ ? But the Perl code is giving error while trying to connect to the SQL in it. The code i tried is below. The connection credentials are the same i use in my PhP in which it connects properly.

#!/usr/bin/perl
# PERL MODULES WE WILL BE USING
use DBI;
# CONFIG VARIABLES
$platform = "MySQL";
$database = "placement";
$host = "localhost";
$port = "8080";
$user = "root";
$pw = "";
#DATA SOURCE NAME
$dsn = "dbi:ODBC:$database:localhost:8080";
# PERL DBI CONNECT
$dbstore = DBI->connect($dsn, $user, $pw) or die "Unable to connect\n";
 print "Connected";

Iam using OPEN Perl IDE under Win7.
And it is giving the following error on compilation

DBI connect('placement:localhost:8080','root',...) failed: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (SQL-IM002) at noname.pl line 14
Unable to connect

Please provide little guidance.:icon_redface:

I don't have Windows, but I think that instead of using the ODBC driver you may have more success using the DBD::mysql driver. For instructions see How to install and configure DBD::mysql

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.