Using ADO and OLEDB and MySql, this error occurs several times.
What I can do to minimize errors, and prevent routine to stop?
Possible causes are:
- ADSL Quality
- Windows limits for half-open connections and dead connections
What changes I made:
- Reduce limit to dead connections (from MySql suggestions)
- Increase time-out limits
I am using Windows 7 Professional, and server have Linux in an internet
location.
My use is like this:
Do While .t.
cnMySql := ConexaoMySql()
cnMySql:Open() // -------------------- Error occurs here
cSql = “SELECT * FROM JPNFEXML WHERE
NECHAVE=’35111111111111111111111’”
rsMySql := cnMySql:Execute(cSql)
Do While .Not. rsMySql:Eof()
rsMySql:MoveNext()
Enddo
rsMySql:Close()
rsMySql := NIL
cnMySql:Close()
cnMySql := NIL
Inkey(120)
Enddo
Function ConexaoMySql()
Local cnMySql
cnMySql := win_OleCreateObject(“ADODB.Connection”)
cnMySql:ConnectionString := “Driver={MySQL ODBC 3.51
Driver};Server=xxx;Option=131072;Stmt=;Database=xxx;User
ID=xxx;Password=xxx;”
cnMySql:CursorLocation = 3
cnMySql:CommandTimeOut = 30
cnMySql:ConnectionTimeOut = 30
Return cnMySql
José M. C. Quintas