Speaking of answering questions.... :) I actually have a question  
that's been bugging me and I haven't been able to get a good answer on  
either the forums or the users list.

This question pertains to MySQL used with Symfony 1.0 and Propel.

I have a LONG running batch script that intermittently needs access to  
MySQL. I begin the script with the lines:

///code
$databaseManager = new sfDatabaseManager();
$databaseManager->initialize();
code////

And the program goes into an event loop, using FAM as the notifier.  
But, if lots of time elapses between the time I initialize and the  
time I need the connection, I get an error about MySQL has gone away.  
This means that the idle timeout was exceeded for MySQL. I know I  
could just set the timeouts to forever, but that is not a tenable  
solution.

The question is: how to I tell Symfony to reconnect to MySQL? Is the  
solution to use something like Propel::getConnection() every time I  
need it? Some other solution? As I mentioned, this script basically  
runs 24/7, only waking up when it needs to do something. As such,  
doing something like upping the MySQL timeout isn't really an option  
for me.

I've tried doing stuff like:

///code
$databaseManager = new sfDatabaseManager();
$databaseManager->initialize();

{do some stuff}

$databaseManager->shutdown();

{wait}

$databaseManager = new sfDatabaseManager();
$databaseManager->initialize();
///code

But that doesn't really work. So I guess the question is, what is the  
best "Symfony" way to do this? I've looked into just grabbing a  
connection from the MySQLConnection class, but that seems to break all  
of the abstraction and sort of defeat the whole purpose of using a  
framework like Symfony in the first place. Could someone please advise?

Best,
JLS




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to