in reply to dbi connection daemon process

Hi, please see How do I post a question effectively? -- it is much easier to help if we can see your code.

In the subroutines should I connect and disconnect the database every +time

No, you should not connect to the DB every time you call a sub, if you can help it: DB connections can be expensive.

can connection gone ?

You can open your DB connection and store the handle in a package variable:

#!/usr/bin/perl use DBI; my $dbh = DBI->connect("dbi:SQLite:dbname=dbfile","",""); sub foo { my $sth = $dbh->prepare( $some_query ); $sth->execute; } sub bar { my $result = $dbh->do( $other_query ); }

Or, for larger applications, see connect_cached() in the DBI documentation for a persistent DB connection handle.

Hope this helps!


update: showed alternative to connect_cached
The way forward always starts with a minimal test.