Bug #53682 Error: Can't create TCP/IP socket - Only while debugging using VisualStudio 2008
Submitted: 16 May 2010 15:27 Modified: 23 Apr 2014 10:10
Reporter: Yaron Tal Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / C++ Severity:S1 (Critical)
Version:1.0.5 (win32) OS:Windows
Assigned to: CPU Architecture:Any

[16 May 2010 15:27] Yaron Tal
Description:
Code Snippet:

Driver *driver;
Connection *con;

const string user = "user";
const string password = "password";
const string database = "database_name";

driver = get_driver_instance();
con = driver -> connect(url, user, password);

----------------------

While trying to debug this snippet of code in visual studio 2008, I received the following exception : 

Can't create TCP/IP socket (10106) (MySQL error code: 2004, SQLState: HY000)

This only happens while the application being debugged using visual studio, if i run the application from command line it works great,

How to repeat:
Try to run the application under visual studio in debug mode
[16 May 2010 18:16] Lawrenty Novitsky
Hi Yaron,
Thank your for your report. I just wanted to clarify what executable do you successfully run from command line - debug or release? if that is release, please try to run debug version from command line and verify if it's successful too.
[23 May 2010 9:04] Yaron Tal
I run from command line both debug and release executables and they works fine,

Yaron
[25 May 2010 7:47] Tonci Grgin
This should be a timeout issue during debug session. Nothing more, imo.
[4 Jun 2010 18:07] charles arthur
same error happens on visual studio 2005.  runs in release mode but not debug. here the exception is NOT caught, instead 
First-chance exception at 0x78144500 in caa_tst.exe: 0xC0000005: Access violation reading location 0xcccccccc.
which is called from
		con = driver -> connect(url, user, password);

 	msvcr80.dll!78144500() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for msvcr80.dll]	
 	msvcp80.dll!7c4239df() 	
 	mysqlcppconn.dll!1000e30c() 	
 	ntdll.dll!7c918f21() 	
 	ntdll.dll!7c9101db() 	
>	msvcp80d.dll!_onexit(int (void)* func=0x00000008)  Line 115 + 0xc bytes	C
 	ntdll.dll!7c9101db() 	
 	ntdll.dll!7c91930f() 	
 	ntdll.dll!7c96f098() 	
 	msvcr80.dll!78180475() 	
 	msvcp80.dll!7c421201() 	
 	msvcp80.dll!7c42394d() 	
 	msvcp80.dll!7c423958() 	
 	msvcp80.dll!7c4249ea() 	
 	mysqlcppconn.dll!1000de94() 	
 	mysqlcppconn.dll!1000df76() 	
 	mysqlcppconn.dll!10010235() 	
 	msvcp80.dll!7c42319e() 	
 	ntdll.dll!7c9101db() 	
 	msvcr80.dll!78134d83() 	
 	msvcp80.dll!7c42317a() 	
 	mysqlcppconn.dll!1000beca() 	
 	mysqlcppconn.dll!1003e4c7() 	
 	mysqlcppconn.dll!100108b7() 	
 	ntdll.dll!7c9101db() 	
 	mysqlcppconn.dll!10011861() 	
 	mysqlcppconn.dll!1003e72b() 	
 	caa_tst.exe!main(int argc=1, const char * * argv=0x00c762a0)  Line 179 + 0x24 bytes	C++
[5 Jun 2010 0:37] charles arthur
i don't believe it's a timeout issue; i built cppcon from source within visual studio 2005 and it runs fine in debug mode, thank you.
[11 Jun 2010 9:58] Sveta Smirnova
Thank you for the feedback.

I can not repeat described behavior. Do you use debug or release build? How do you debug application? Is error repeatable with part of code you provided or there is something else? Do you connect to local or remote server?

I used following code to debug this problem:

// bug53682.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdlib.h>
#include <iostream>

#include "mysql_connection.h"

#include <cppconn/driver.h>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	sql::Driver *driver;
	sql::Connection *con;

	const string user = "root";
	const string password = "";
	const string database = "test";

	driver = get_driver_instance();
	con = driver -> connect("tcp://127.0.0.1:3306", user, password);

	return 0;
}

Please try if problem is repeatable with such code in your environment.
[11 Jul 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[23 Apr 2014 10:09] Bogdan Degtyariov
Posted by developer:
 
Cannot repeat