Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speed Issue with SQLConnect
Message
 
À
27/01/2005 12:20:37
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
00981265
Message ID:
00981572
Vues:
44
Calvin,
I'm new at MySQL but this connection code has been working really well for me.
* Syntax from www.ConnectionStrings.com
* ODBC 3.51 Local database:
*
* Connect Parameters
mDriver = "DRIVER=" + "{MySQL ODBC 3.51 Driver}"
mDesc   = "DESC="   + ""
mDB     = "DB="     + ""
mServer = "SERVER=" + "localhost"  && Need to change 
mUser   = "UID="    + "root"       && Need to change 
mPassword = "PASSWORD=" + "root"   && Need to change 
mPort   = "PORT="   + "3306"
mSocket = "SOCKET=" + ""
mOption = "OPTION=" + "3"
mStmt   = "STMT="   + ""
*
mConnectString = ;
mDriver  + ";" ;
+ mDesc    + ";" ;
+ mDB      + ";" ;
+ mServer  + ";" ;
+ mUser    + ";" ;
+ mPassword + ";" ;
+ mPort    + ";" ;
+ mSocket  + ";" ;
+ mOption  + ";" ;
+ mStmt    + ";"
*
mHandle = SqlStringConnect(mConnectString)
*
* Make sure it connected
? 'Handle Number: '
?? alltrim(str(mHandle))
if mHandle < 0
  return
endif

>I am trying to connect to MYSql using the MySQL ODBC 3.51 DSN driver. When I test the ODBC connection it makes connection in < 1 second. However, in VFP using either SQLConnect or SQLString Connect a connection takes 23 to 30 seconds. Anything I can do to speed this up? Thanks for the help. My test code below:
>
>STORE SQLCONNECT('xxxxxx', 'xxxxx','xxxxx') TO myh
>*STORE SQLSTRINGCONNECT('dsn=xxxxx;uid=xxxxx;pwd=xxxxx') TO myh
>IF myh < 0
> = MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
>ELSE
> * to this point takes 23 to 30 seconds.
> = MESSAGEBOX('Connection made', 48, 'SQL Connect Message')
> r=SQLTABLES(myh, "TABLE", "mydbresult")
> if r=1
> select mydbresult
> browse
> else
> wait 'Not able to read' window
> endif
> = SQLDISCONNECT(myh)
>ENDIF
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform