<%doc>
# 
# $Id: db-connect.ipfc-sample,v 1.2 2002/01/28 01:07:32 fpmip Exp $
#
# db-connect.ipfc makes database connections to the db-backend

# Authors : Tycho Fruru <tycho@fruru.com>
#           Alexandre Dulaunoy <alex@thinkingsecure.com>
# Copyright (C) 2001, 2002 Tycho Fruru <tycho@fruru.com>
# Copyright (C) 2001, 2002 Conostix S.A. Luxembourg - Tycho Fruru <tycho@conostix.com>
# Copyright (C) 2001, 2002 Alexandre Dulaunoy <alex@foo.be>

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
</%doc>
<%args>
$db => 'ipfc'
$username => 'webserver'
$password => ''
</%args>

<%perl>
use DBI;

my $connect_string = "dbi:Pg:dbname=$db";

my $dbh = DBI->connect($connect_string,$username,$password,{AutoCommit=>1})
	or $m->abort("Database connection failed");
	
return $dbh;
</%perl>
