I have an Access file running a query that does not have the same behavior on my desktop and on a server running Windows 2003 Server. This query retrieves data from several MySQL linked tables using the MyODBC connector in order to insert it into another work table in my Access file.
On my desktop, everything just works fine, the query takes approximatively 20 seconds to run. But when I try to do the same thing on the 2003 server, the query takes infinite time to run, and even after several minutes, it keeps running without populating my Access table.
Here is what is logged by the MySQL ODBC connector on my desktop :
SELECT `wsDispo_produits`.`code_fournisseur` ,`wsDispo_produits`.`code_int_produit` ,`wsDispo_produits`.`ref_fournisseur` ,`wsDispo_produits`.`qte_plaque` ,`wsDispo_produits`.`plaques_par_roll` ,`wsDispo_produits`.`prix` ,`wsDispo_produits`.`prix_etage` ,`wsDispo_produits`.`prix_roll` ,`wsProduits`.`designation` ,`wsProduits`.`taille_pot` ,`wsProduits`.`hauteur` ,`wsProduits`.`gencod` ,`wsFournisseur`.`raison_sociale` ,`wsProvenance`.`type_expedition` ,`wsProvenance`.`comm_produit` ,`wsProvenance`.`comm_transport` ,`wsProvenance`.`coef_transport` ,`wsTarifs_expedition`.`tarif` FROM `wsDetail_offre`,`wsZone_departements`,`wsDispo_produits`,`wsProduits`,`wsProvenance`,{oj `wsFournisseur` LEFT OUTER JOIN `wsTarifs_expedition` ON (`wsFournisseur`.`code_fournisseur` = `wsTarifs_expedition`.`code_fou` ) } WHERE ((((((`wsDetail_offre`.`code_int_produit` = `wsDispo_produits`.`code_int_produit` ) AND (`wsDetail_offre`.`code_fournisseur` = `wsDispo_produits`.`code_fournisseur` ) ) AND (((`wsZone_departements`.`departement` IN ('*' ,'75' ) ) AND ((`wsZone_departements`.`code_fournisseur` = `wsDispo_produits`.`code_fournisseur` ) AND (`wsZone_departements`.`code_zone` = `wsDispo_produits`.`code_zone` ) ) ) AND (`wsDispo_produits`.`code_fournisseur` = `wsFournisseur`.`code_fournisseur` ) ) ) AND (`wsDispo_produits`.`code_int_produit` = `wsProduits`.`code_produit` ) ) AND (`wsFournisseur`.`code_pro` = `wsProvenance`.`code_pro` ) ) AND (((`wsTarifs_expedition`.`departement` IS NULL ) OR ((`wsTarifs_expedition`.`departement` = '75' ) AND (`wsTarifs_expedition`.`nb_max_roll` = 3 ) ) ) AND ((`wsDetail_offre`.`code_liste` )= ANY (SELECT `wsOffre`.`code_liste` FROM `wsOffre` WHERE ((`wsOffre`.`date_deb` = {ts '2011-07-01 15:00:00'} ) AND (`wsOffre`.`date_fin` = {ts '2011-07-08 15:00:00'} ) ) ))) ) ;
COMMIT;
And next the log on the 2003 server :
SELECT `wsDetail_offre`.`code_liste` ,`wsDispo_produits`.`code_fournisseur` ,`wsDispo_produits`.`code_int_produit` ,`wsDispo_produits`.`ref_fournisseur` ,`wsDispo_produits`.`qte_plaque` ,`wsDispo_produits`.`plaques_par_roll` ,`wsDispo_produits`.`prix` ,`wsDispo_produits`.`prix_etage` ,`wsDispo_produits`.`prix_roll` ,`wsFournisseur`.`code_fournisseur` ,`wsFournisseur`.`raison_sociale` ,`wsFournisseur`.`code_pro` ,`wsProduits`.`designation` ,`wsProduits`.`taille_pot` ,`wsProduits`.`hauteur` ,`wsProduits`.`gencod` FROM `wsDetail_offre`,`wsZone_departements`,`wsDispo_produits`,`wsFournisseur`,`wsProduits` WHERE ((((`wsDetail_offre`.`code_int_produit` = `wsDispo_produits`.`code_int_produit` ) AND (`wsDetail_offre`.`code_fournisseur` = `wsDispo_produits`.`code_fournisseur` ) ) AND (((`wsZone_departements`.`departement` IN ('*' ,'75' ) ) AND ((`wsZone_departements`.`code_fournisseur` = `wsDispo_produits`.`code_fournisseur` ) AND (`wsZone_departements`.`code_zone` = `wsDispo_produits`.`code_zone` ) ) ) AND (`wsDispo_produits`.`code_fournisseur` = `wsFournisseur`.`code_fournisseur` ) ) ) AND (`wsDispo_produits`.`code_int_produit` = `wsProduits`.`code_produit` ) ) ;
SELECT `code_fou` ,`departement` ,`nb_max_roll` ,`tarif` FROM `wsTarifs_expedition` WHERE (`code_fou` = 1);
SELECT `code_pro` ,`type_expedition` ,`comm_produit` ,`comm_transport` ,`coef_transport` FROM `wsProvenance` WHERE (`code_pro` = 1);
SELECT `code_pro` ,`type_expedition` ,`comm_produit` ,`comm_transport` ,`coef_transport` FROM `wsProvenance` WHERE (`code_pro` = 1);
...
And it keeps running queries like the last two until I kill MsAccess. I can't figure out why the query is not executed the same way. Already checked that same versions of both MsAccess and ODBC Connector are ran (MsAccess 2003 SP3 and MySQL Connector 5.1.8). I ran the same test on another server running Windows Server 2008 and it works fine like my desktop. I even tried on the 2003 server to repair Office and uninstall / reinstall ODBC Connector.
The only thing I noticed is that on the 2003 server the query开发者_StackOverflow is transformed in order not to use the LEFT OUTER JOIN.
Has someone any explainations on this ?
Thanks.
精彩评论