×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Database Advice for perl newbie
2

Database Advice for perl newbie

Database Advice for perl newbie

(OP)
Hi , I'm a student taking perl at the moment and my class doesn't cover databases so I want to go out on my own to learn it myself.

I have some server space that I purchased on the web and they are using MySQL. So I am looking for a good way to learn the connectivity and data manipulation of this type of database. Any links or reference books you can tell me about I would greatly appreciate it.

I have done some searching on the web and I found a Win32::ODBC module but wasn't sure if thats what I needed or if my web service even has this. Again any advice would be greatly appreciated.

Thanks, Rick

RE: Database Advice for perl newbie

Check out the DBI package on CPAN. It's what I use and it's great.

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.

RE: Database Advice for perl newbie

Go spend $35 on 'Programming the Perl DBI' by Descarte and Bunce, published by O'Reilly.  It goes over some basic SQL stuff ( the language you use to talk to a Database) and addresses connecting to and interacting with databases.  Most of the examples use Oracle, but, the beauty of the DBI/DBD approach is that if you know how to connect to an Oracle instance, then you pretty much know how to connect to a MySQL instance.

HTH


 
 
 keep the rudder amid ship and beware the odd typo

RE: Database Advice for perl newbie

There's also a terrific MySQL reference at: http://www.mysql.com/documentation/mysql/bychapter/

I go there all the time to find SQL syntax for things I need to do.

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.

RE: Database Advice for perl newbie

(OP)
Thanks,for the info. I did see the DBI book at the store but wasn't sure that wouldhelp me, but now I know different. I will definately check out all the links as well.

RE: Database Advice for perl newbie

(OP)
I'm back with another question. My provider is using Mod_perl, does that include the DBI module? I called to ask them but the tech seemed like he didn't know what I was talking about.

Thanks,
Rick

RE: Database Advice for perl newbie

That's not surprising. It's amazing how many ISP tech support people I've talked to are clueless about their setup.

mod_perl does not, so far as I know, inherently include DBI. My suggestion would be to try to include the lib and see what happens.

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.

RE: Database Advice for perl newbie

(OP)
Well, I'm not getting off the ground very well. Here is my connection code:

$DSN= "dbi:mysql:$database";
my $dbh = DBI->connect($DSN,$user,$pass) || die print "$DBI::errstr\n";

and I get the error:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

Again I e-mailed my Tech support and again they didn't know squat.

It looks to like the DBI module is installed since its looking for the driver, am I correct in assuming this?

Any help would be appreciated.

Thanks!

RE: Database Advice for perl newbie

To tell if the module is installed, just try to 'use' it.  If it is not there, the 'use' will fail.

!#/usr/local/bin/perl
use DBI;
use CGI;
my $cgi = new CGI;
print $cgi->header,$cgi->start_html;
print "<P>The 'use' worked'.</P>\n";
print $cgi->end_html;


If the 'use' works, then you should get you message.  If it does not, then will see some sort of error.



HTH


 
 
 keep the rudder amid ship and beware the odd typo

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close