reconnect

reconnect

am 20.08.2002 10:24:57 von Thomas Jalsovsky

Hello,

I have a perl script which runs in daemon mode. It works fine. Now
I would like to implement failover handling.
Do I need to reconnect if my database goes away and goes back?
1. db shutdown
2. some sql queries which fail (error handling)
3. db back
4. ?reconnect?
4?5. sql queries
....

Thanks in advance,
Thomas


------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1889@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: reconnect

am 20.08.2002 11:33:06 von Uli B

why don't you give it a try and restart mysqld and after
mysqld is up again check if the open handle is connected=20
still/again.
you might want to check the DBI->ping method to
recognize a broken link so that you don't "loose"
any queries. depending on your needs you might pause
until mysqld is back or immediately try to reconnect
or use replication functionality or die in panic :-)

Uli

At 10:24 20.08.02 +0200, Thomas Jalsovsky wrote:
>
>Hello,
>
> I have a perl script which runs in daemon mode. It works fine. Now=20
>I would like to implement failover handling.=20
> Do I need to reconnect if my database goes away and goes back?
>1. db shutdown
>2. some sql queries which fail (error handling)
>3. db back
>4. ?reconnect?=20
>4?5. sql queries
>...
>
> Thanks in advance,
> Thomas
>

--=20
-----------------------------------------------
Ulrich Borchers
Brandenberger Straße 18, 41065 Mönchengladbach
fon +49-2161-175883
icq 1282868
-----------------------------------------------


------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1891@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: reconnect

am 20.08.2002 11:33:06 von Uli B

why don't you give it a try and restart mysqld and after
mysqld is up again check if the open handle is connected=20
still/again.
you might want to check the DBI->ping method to
recognize a broken link so that you don't "loose"
any queries. depending on your needs you might pause
until mysqld is back or immediately try to reconnect
or use replication functionality or die in panic :-)

Uli

At 10:24 20.08.02 +0200, Thomas Jalsovsky wrote:
>
>Hello,
>
> I have a perl script which runs in daemon mode. It works fine. Now=20
>I would like to implement failover handling.=20
> Do I need to reconnect if my database goes away and goes back?
>1. db shutdown
>2. some sql queries which fail (error handling)
>3. db back
>4. ?reconnect?=20
>4?5. sql queries
>...
>
> Thanks in advance,
> Thomas
>

--=20
-----------------------------------------------
Ulrich Borchers
Brandenberger Straße 18, 41065 Mönchengladbach
fon +49-2161-175883
icq 1282868
-----------------------------------------------


------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1891@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: reconnect

am 20.08.2002 14:00:24 von Jochen Wiedmann

Zitiere Thomas Jalsovsky :

>
> Do I need to reconnect if my database goes away and goes back?
> 1. db shutdown
> 2. some sql queries which fail (error handling)
> 3. db back
> 4. ?reconnect?
> 4?5. sql queries

The driver has a certain degree of ability to
reconnect. However, that only works in the absence
of transactions, which you are most probably going
to use.

I would suggest to encapsulate the database handling.
If something goes wrong, assume the database connection
to be dead. Close it and reconnect.



------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1892@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: reconnect

am 20.08.2002 14:00:24 von Jochen Wiedmann

Zitiere Thomas Jalsovsky :

>
> Do I need to reconnect if my database goes away and goes back?
> 1. db shutdown
> 2. some sql queries which fail (error handling)
> 3. db back
> 4. ?reconnect?
> 4?5. sql queries

The driver has a certain degree of ability to
reconnect. However, that only works in the absence
of transactions, which you are most probably going
to use.

I would suggest to encapsulate the database handling.
If something goes wrong, assume the database connection
to be dead. Close it and reconnect.



------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1892@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.