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:
use DBI;
my $database = 'databasename';
my $dbuser = 'username';
my $usrpsswd = 'password';
my $dbtable = 'tablename';
Then you need to define a database connection, and a query (here defined for PostgreSQL):
my $dbconnection = DBI->connect("dbi:Pg:dbname=$database", $dbuser, $u
+srpsswd);
Then you will need to prepare an SQL query for your connection:
my $query = $dbconnection->prepare(<<End_SQL);
SELECT something1,something2 FROM $dbtable
End_SQL
Then execute:
$query->execute();
Then you can make, for example, a while loop to catch all the things you asked for in your query:
while (($something1,$something2) = $query->fetchrow_array() ) {
do your stuff here
}
# and then disconnect
$dbconnection->disconnect();
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!