Page 1 of 1

Detect Mysql Version

Posted: 19.01.2009, 15:51
by iLLiCiT
Hi to all...
I've developed several internal apps for a company, using Zeos Lib (a big thanks to the devteam 4 making this possible). The company is using mysql4.0 server and the only way it hasn't upgraded yet is due to the other software limitations. Now that the rest of the software got updated and can connect to mysql5, the company decided to begin the transition to mysql5.
But here is my problem. The transition will last about a month, so that about 60 servers will get upgraded from mysql4 to mysql5.
The apps i created can handle the transition if i recompile the apps using either mysql-4.0 as protocol or mysql-5.0 . But there is a issue how the app could decide which protocol to use. (this should not and can ot be done by the user).
It crossed my mind :idea: about using a tcp connection to the server and read the handshake message but i am open to suggestions!

I have about 2 weeks to implement this on 10 apps so please understand me if i sound i little bit of desperate ... :roll:

Posted: 19.01.2009, 16:26
by mdaems
Doesn't the mysql 5 dll connect to a 4.0 server (using the 5.0 protocol)? That would be the easiest solution.

If that doesn't work I can only suggest using a 5.0 master server for telling you what servers are converted. Then a simple query over a mysql5 connection can decide what protocol to use for the 'real connections'. This special service doesn't contain lots of secrets (1 two field table) so this could even happen over an anonymous connection.

Once this is available you can fill the protocol property of your connection components depending on the host name you're using.
This can be done using one procedure which creates and frees a separate TZConnection on the fly. After the conversion this procedure can be easily modified to remove the overhead until you need it again.

Mark

P.S. Planning: One day setting up the service on an idle box (or the first mysql 5 server). One day making a procedure to correct the protocol between setting the hostname and opening the connection. 2 days for adding the procedure in the right places in your apps. 8 working days left for handling tests and the famous 'unforeseen' events.

Posted: 20.01.2009, 08:35
by iLLiCiT
I've had a lot of trouble using different version dll with different version of mysql. More handshake problems, some out of range exceptions etc. but all go away if i match the version of protocol - dll - mysql.
What you are proposing could work. For this to work, the sysadmins of the servers should update the master server after each conversion. Also, because the servers are geographically scattered all over the country, there are some issues of security.
I'll discuss this solution with the sysadmin team and see if it is a viable solution...

Thank you very much. You've been help full.