CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI:
Compile error


New User

Mar 5, 2009, 11:41 AM

Post #1 of 3 (7147 views)
Compile error Can't Post

Hi I'm new to perl and I wrote a script to connect to a mysql database i have but my problem is whenever i go to run it i get this error

Can't locate in @INC (@INC contains: /usr/perl5/5.8.4/lib/sun4-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/sun4-solaris-64int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl .) at line 3.
BEGIN failed--compilation aborted at line 3.

I have installed DBI on the SunOS 5.10 server which is running perl, v5.8.4 built for sun4-solaris-64int. Can somebody please help me or point me in the right direction? Thanks!

print "Content-type: text/html nn";
use DBI; # Connect To Database
$database = "XXX";
$username = "XXX";
$password = "XXX";
$hostname = "localhost";
$db = DBI->connect("DBI:mysql:$database:$hostname", $username, $password);


Mar 6, 2009, 9:13 AM

Post #2 of 3 (7141 views)
Re: [Fritter] Compile error [In reply to] Can't Post

Hi Fritter,

Well, you have a problem with your perl installation. This problem should compile as written.

One thing I noticed is that most L/Unix systems put perl in /usr/lib/perl5. You may have put DBI there by mistake. How did you install DBI?

Also, once you get your DBI (and you will also need DBD::mysql) installation straightened out, the dsn in your connect statement is wrong. It should be:

$db = DBI->connect("DBI:mysql:database=$database;host=$hostname", $username, $password);



Veteran / Moderator

Mar 6, 2009, 11:01 AM

Post #3 of 3 (7138 views)
Re: [1arryb] Compile error [In reply to] Can't Post


Both forms of the connect statement are valid. In fact, I never use the more verbose syntax.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives