Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to SQL 3

Status
Not open for further replies.

perlone

Programmer
Joined
May 20, 2001
Messages
438
Location
US
I learned some basics of SQL but how do i connect it to perl? So i could use the sql statements on perl like(SELECT,UPDATE).
 
I assume that by "SQL" you mean you want to connect Perl to a database - or use Perl to access a database using SQL statements like SELECT and UPDATE. Have a look at the Connecting Perl to Databases FAQ in this forum - it tells you where to find Perl Database resources. You'll first have to decide which database you're going to use - assuming that it will be MySQL(since I have to just pick one for an example), then you'll need to install

1. MySQL, and get it working, then
2. Perl "DBI"
3. Perl "DBD::mysql"

If you're not experienced with databases, then step 1 will probably take you some time. Don't dive into 2 or 3 until you are comfortable that your database is up and running smoothly, and you're able to connect to it and interact with it using the database client(for MySQL the client is "mysql", for Oracle the client is "sqlplus", etc.).

If you do choose MySQL, their website( has lots of very good information on all aspects of MySQL, including tutorials. Whichever db you choose, find a good tutorial, and I would advise to buy at least 1 good book on that db.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
I would also highly suggest reading Programming The Perl DBI by Descartes and Bunce. Excellent book by O'Reilly that is only about 30 bucks.

It is definitely the most comprehensive book I have read in regards to Perl and the DBI (seeing as Tim Bunce is the original author of the DBI).

Anyway, thats just what I suggest.

Hope this helps.

-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====
 
I agree with Vic - that is an excellent book that I would also highly recommend.

I also wanted to suggest you read the perldocs that come with your Perl installation and that come with each Perl module you install from CPAN.

To see the perldocs for the DBI module, do this(after you've successfully installed the module)

perldoc DBI

And to see the perldocs for the DBD::mysql module, do this:

perldoc DBD::mysql

This is true on *nix, but I'm not sure how to get those same perldocs on a windows system.

HTH.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top