No such thing as a small change | |
PerlMonks |
Re: Setting up the dbi modulesby hda (Chaplain) |
on May 30, 2009 at 08:05 UTC ( [id://767020]=note: print w/replies, xml ) | Need Help?? |
Hi, I might not be the ideal person to answer this, as I am not an expert in the field of databases. I have however some daily experience accessing PostgreSQL databases from Perl programs, so I hope this will help you. To begin with, we will only use DBI and assume you already have a user and a password, to access some table in some database. Then we can define:
Then you need to define a database connection, and a query (here defined for PostgreSQL):
Then you will need to prepare an SQL query for your connection:
Then execute:
Then you can make, for example, a while loop to catch all the things you asked for in your query:
These very simple things work for me. Be careful that I have not mentioned anything on secure connections and other advanced stuff. Other monks might be able to help on that. My lines only refer to very simple and basic database access. Hope this helps!
In Section
Seekers of Perl Wisdom
|
|