-
October 27th, 2018, 07:44 AM
#1
MySQL ODBC Connection Timeout VC++
Hi,
I'm using VS 2012, MySQL version 5.6 and ODBC Version 5.3.11 in Windows 7 Embedded OS 32 bit.
I was running my application from start up. Some time data base can not connect and also time out.
But i was checked, is mysql service running or not?. Always MySQL service is running but some times Database cannot connect.
Code:
BOOL openDB()
{
sDBName = "LMS";
DBUseStr = "USE `" + sDBName + "`";
FlushStr = "FLUSH PRIVILEGES";
sServer = "127.0.0.1";
sUser = "root";
sPassword = "password";
//sDSN.Format("Driver={MySQL ODBC 5.2 ANSI Driver};Server=127.0.0.1;User=root;Password=client;Option=4;");
TRY
{
sDSN.Format("Driver={MySQL ODBC 5.3 ANSI Driver};Server=" + sServer + ";User=" + sUser + ";Password=" + sPassword + ";Option=4;");
DB.Open(NULL,false,false,sDSN,false); //Some times can not come out from this line
DB.ExecuteSQL(DBUseStr);
DB.ExecuteSQL(FlushStr);
}
CATCH(CDBException, e)
{
::AfxMessageBox("OpenDB_Error-"+e->m_strError);
return FALSE;
}
END_CATCH;
return TRUE;
}
How can i use the timeout process with this? Changed like below, but couldn't time out.
Code:
sDSN.Format("Driver={MySQL ODBC 5.3 ANSI Driver};Server=" + sServer + ";User=" + sUser + ";Password=" + sPassword + ";Option=4; Connection Timeout=5;");
Regards,
SaraswathiSrinath
-
October 27th, 2018, 04:59 PM
#2
Re: MySQL ODBC Connection Timeout VC++
-
October 30th, 2018, 12:08 AM
#3
Re: MySQL ODBC Connection Timeout VC++
I will try and get back to you
Regards,
SaraswathiSrinath
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|