perl and SQL question
Anton
zav at tomica.ru
Tue Apr 4 10:13:13 CEST 2017
Hi.
I have next code in perl module to communicate with postgresql:
...
our $pgclientsn = "DBI:Pg:dbname=mydb;host=10.14.2.66;port=5432;";
...
sub CLONE {
...
# remote psql
$pgclientdbh = DBI->connect($pgclientsn, 'username', 'password',{AutoCommit => 1,pg_server_prepare => 1});
# accoutning stop insert (?)
$astopins = $pgclientdbh->prepare("INSERT INTO telephonecallacct (username,acctstarttime,acctstoptime,acctsessiontime,callingstationid,calledstationid,calldirection) VALUES (?,TO_TIMESTAMP(?),TO_TIMESTAMP(?),?,?,?,?)");
...
# check service status for tel.number -- check number status
$numstatcheck = $pgclientdbh->prepare("SELECT s.enabled FROM telephony_numbers AS tn, service AS s WHERE number = ? AND tn.sid = s.id");
...
}
today postgres was unaccessible for 10 minits (some pg processes were core dumped). freeradius started responding "Invalid user" and stayed in
this state until the freeradius restart.
How should I modify perl code to restart sql connection automatically or periodically or something else to prevent sql connection problems ?
If this possible at all ?
More information about the Freeradius-Users
mailing list