954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Perl DB stuck

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:

uvray90
Newbie Poster
6 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

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

d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: