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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL/DBI

Status
Not open for further replies.

sulfericacid

Programmer
Aug 15, 2001
244
0
0
US
I am trying to venture into the world of perl databases, specifically MySQL. Problem is, even with the few books the library has I am having problems finding anything I can understand. It looks like most of the books are aimed towards people who already have a little knowledge in it.

I actually tried throwing SQL commands up in my Perl script because someone directed me towards an SQL tutorial (needless to say a lot of perl programmers who saw what I attempted to do laughed at me for attempting perl/sql!). What exactly is DBI in relation to MySQL? Is it just the module that lets you connect to the database? If that's so, I thought MySQL was designed specifically for perl..and if this is the case, why would it require a module to connect to it?

Thanks for clearing things up, I am so so so so confused!

sulfericacid

"Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid
 
OK, sulfericacid. Let me see if I can help reduce you to only so confused ;-)

DBI is more of a bridge module. Basically it acts as an abstraction layer between your perl program and the database engine. The other half of the DBI puzzle is the various DBD modules, in this case DBD::mysql. The DBD modules impliment the DBI abstractions for each database. The main advantage is once a DBI script is written you can move to a different database with a single change to your connection string.

For a tutorial/overview of DBI/DBD check out this link:


Also take a look at the example code included with DBD::mysql. It can give you the basics of how you might write your code.

Hope that helps.
 
Also, MySQL was not specifically designed for any particular programming language. I have used MySQL and successfully connected to it via Perl, PHP, and Java. Each type of language that wants to connect to MySQL must have its own module, or functions, or drivers available for the language to communicate with the DB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top