in reply to DB Connections across scripts from a module

Just a guess (since you do not show any code:
When you execute the connect:
$dbh = DBI->connect($data_source, $username, $auth, \%attr);
are you declaring the database handle globally or are you declaring it within the "connect" subroutine? If it is the latter, you will never see a connection in other subroutines.

Also, are you checking to make sure that the connect was successful? See perldoc DBI.

Replies are listed 'Best First'.
Re^2: DB Connections across scripts from a module
by LinuxUser2008 (Acolyte) on Jun 07, 2010 at 03:56 UTC
    Hi proceng,
    I am declaring it globally, so i guess, the var does not go out of context and also, i am able to access the var from other subs..

    As JavaFan had stated, the connection is closed when the first script A's execution is complete.. And for the next script to execute, (as it is executed a bit later) we need to initiate a new connection.. Perl modules get unloaded and loaded back in the memory(for every script execution), i guess..
    If i have said something wrong, please correct me

    Regards,
    Blub:)

      If i have said something wrong

      Most definitely. It's not clear what since I don't know how you invoke each script.

      If the process in which script A executed exited, then the var did go out of scope contrary to what you said.

      If the process in which script A executed did not exit, then no modules got unloaded contrary to what you said.