Getting started with Membership etc
If I am trying to use an old connection (which I am not) then I can see that an eight hour time out is a more than reasonable time for it to have been kept alive before being destroyed.
But as you can see from my code, I am setting up a new connection each time the web page is requested, so it cannot be anywhere near 8 hours old. The "lost connection" message is returned immediately the page is requested (< 1second).
It's almost as if when I set up the new connection using the ConnectionString method it thinks there is a connection that can be used, but in fact there is not (because it has been destroyed). However if I set up the connection using object properties instead, it correctly creates a new connection and there is no problem. Surely if "wait_timeout" was the problem it would affect the "property setting" method in the same way as the ConnectionString method?
The "lost connection" only happens once, on the first MySQL access in the day.
Having read this do you still think it is worth me changing "wait_timeout"?
But as you can see from my code, I am setting up a new connection each time the web page is requested, so it cannot be anywhere near 8 hours old. The "lost connection" message is returned immediately the page is requested (< 1second).
It's almost as if when I set up the new connection using the ConnectionString method it thinks there is a connection that can be used, but in fact there is not (because it has been destroyed). However if I set up the connection using object properties instead, it correctly creates a new connection and there is no problem. Surely if "wait_timeout" was the problem it would affect the "property setting" method in the same way as the ConnectionString method?
The "lost connection" only happens once, on the first MySQL access in the day.
Having read this do you still think it is worth me changing "wait_timeout"?
You are correct - Ping returns "false" when the error occurs. So I can detect it.
Having detected the error, I want to make a connection that does not fail so I've:
(1) Closed the connection which has the error
(2) Set that connection to Nothing to destroy it
(3) Called MySqlConnection.ClearAllPools()
(4) Created a new connection and openned that
To avoid fiddling with the MySQL setup I need to wait 8 hours before testing this.
From your documentation I am a little concerned that step (3) will not work, as this call is asynchronous and take 30 seconds. Is there a better way of guaranteeing a good connection?
I must say I'm a little concerned that I'm writing code that is trying to overcome a problem that appears to lay in either MySQLDirect or MySQL. Am I correct in thinking code beneath mine tries to use an invalid internal database connection as soon as I create a new instance of a MySqlConnection?
Having detected the error, I want to make a connection that does not fail so I've:
(1) Closed the connection which has the error
(2) Set that connection to Nothing to destroy it
(3) Called MySqlConnection.ClearAllPools()
(4) Created a new connection and openned that
To avoid fiddling with the MySQL setup I need to wait 8 hours before testing this.
From your documentation I am a little concerned that step (3) will not work, as this call is asynchronous and take 30 seconds. Is there a better way of guaranteeing a good connection?
I must say I'm a little concerned that I'm writing code that is trying to overcome a problem that appears to lay in either MySQLDirect or MySQL. Am I correct in thinking code beneath mine tries to use an invalid internal database connection as soon as I create a new instance of a MySqlConnection?
If MySqlConnection.Ping returns false, the connection is automatically removed from the pool, so you don't have to call MySqlConnection.ClearAllPools(). Actually, setting connection instance to Nothing does nothing (in terms of the underlying physical connection) if you previously closed it.
So I propose the following algorithm: if Ping() returned false, you should close the connection, create a new one and open it.
So I propose the following algorithm: if Ping() returned false, you should close the connection, create a new one and open it.
-
- Posts: 3
- Joined: Mon 13 Aug 2007 18:31
Same Problem
Hi there... what was the wrong setting in web.config?
I have the same problem, but with PgSql (the problem with unknown Keyword :HOST)
this is the connection string
when changing it to:
(deleted Schema and renamed Host to server),
i get Connection refused and it does not work anyway
Thank you for comments
I have the same problem, but with PgSql (the problem with unknown Keyword :HOST)
this is the connection string
Code: Select all
Code: Select all
add name="LocalPgSqlServer" connectionString="User Id=test;Password=test;Server=localhost;Database=test" providerName="CoreLab.PostgreSql"/>
i get Connection refused and it does not work anyway
Thank you for comments