Dear MySQLers,
I've recently installed MySQL C++ Connector, and I'm running into problems once I actually try to make a connection. I would very much appreciate hearing any thoughts that people have about what's going wrong.
I've installed MySQL Server 5.5 (x64) and MySQL C++ Connector 1.1.0 (x64), both using the MSI. I'm running on Windows 7 (x64). I'm using Visual Studio 2010 with the Windows Software Development Kit (SDK1), so that I can process in 64-bit mode (I was getting lots of bugs in 32-bit mode). I'm running Visual Studio as an Administrator.
I'm currently trying to run some very simple programs, such as these two examples from the MySQL website:
http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-1.html
http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-2.html
The only modification I've made to these programs is that, before any of the headers, I've inserted the following line:
#define CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES 1;
Also, in Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, I have entered CPPCONN_PUBLIC_FUNC=
When I try to run the example programs, I encounter some exceptions that I don't understand. For example 1, the program stops at the connect command and reports:
First-chance exception at 0x000007fefde3cacd (KernelBase.dll) in SQLTest.exe: Microsoft C++ exception: sql::SQLException at memory location 0x002be1b0..
First-chance exception at 0x5583fcf4 (msvcp100.dll) in SQLTest.exe: 0xC0000005: Access violation reading location 0x0000000000000030.
In the console, the error message I get is:
# ERR: SQLException in <filename> on line 51 <note-- this is a line in the catch statement and not in the try section>
# ERR: Access denied for user '"C:\Users\Chris\'@'localhost' (using password: YES) (MySQL error code: 4391472, SQLState
Visual Studio also opens up the following file:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\streambuf"
and it points to the "overflow" line from the following code in streambuf:
virtual streamsize __CLR_OR_THIS_CALL xsputn(const _Elem *_Ptr,
streamsize _Count)
{ // put _Count characters to stream
streamsize _Size, _Copied;
for (_Copied = 0; 0 < _Count; )
if (0 < (_Size = _Pnavail()))
{ // copy to write buffer
if (_Count < _Size)
_Size = _Count;
_Traits::copy(pptr(), _Ptr, (size_t)_Size);
_Ptr += _Size;
_Copied += _Size;
_Count -= _Size;
pbump((int)_Size);
}
else if (_Traits::eq_int_type(_Traits::eof(),
overflow(_Traits::to_int_type(*_Ptr))))
break; // single character put failed, quit
else
{ // count character successfully put
++_Ptr;
++_Copied;
--_Count;
}
return (_Copied);
}
When I try running example 2, I get basically the same result, but instead of access denied, it says:
# ERR: Unknown MySQL server host '<happy face icon>' (0)
MySQL error code: 983600
(another run returned MySQL error code: 3998256).
The problems are coming up anytime I try to call the connect() function. Does anyone have any thoughts on what I could be doing wrong or how I could tweak things to get C++ Connector to work?
Thank you very much for your time.
Best regards,
Chris
I've recently installed MySQL C++ Connector, and I'm running into problems once I actually try to make a connection. I would very much appreciate hearing any thoughts that people have about what's going wrong.
I've installed MySQL Server 5.5 (x64) and MySQL C++ Connector 1.1.0 (x64), both using the MSI. I'm running on Windows 7 (x64). I'm using Visual Studio 2010 with the Windows Software Development Kit (SDK1), so that I can process in 64-bit mode (I was getting lots of bugs in 32-bit mode). I'm running Visual Studio as an Administrator.
I'm currently trying to run some very simple programs, such as these two examples from the MySQL website:
http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-1.html
http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-2.html
The only modification I've made to these programs is that, before any of the headers, I've inserted the following line:
#define CPPCONN_DONT_TYPEDEF_MS_TYPES_TO_C99_TYPES 1;
Also, in Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, I have entered CPPCONN_PUBLIC_FUNC=
When I try to run the example programs, I encounter some exceptions that I don't understand. For example 1, the program stops at the connect command and reports:
First-chance exception at 0x000007fefde3cacd (KernelBase.dll) in SQLTest.exe: Microsoft C++ exception: sql::SQLException at memory location 0x002be1b0..
First-chance exception at 0x5583fcf4 (msvcp100.dll) in SQLTest.exe: 0xC0000005: Access violation reading location 0x0000000000000030.
In the console, the error message I get is:
# ERR: SQLException in <filename> on line 51 <note-- this is a line in the catch statement and not in the try section>
# ERR: Access denied for user '"C:\Users\Chris\'@'localhost' (using password: YES) (MySQL error code: 4391472, SQLState
Visual Studio also opens up the following file:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\streambuf"
and it points to the "overflow" line from the following code in streambuf:
virtual streamsize __CLR_OR_THIS_CALL xsputn(const _Elem *_Ptr,
streamsize _Count)
{ // put _Count characters to stream
streamsize _Size, _Copied;
for (_Copied = 0; 0 < _Count; )
if (0 < (_Size = _Pnavail()))
{ // copy to write buffer
if (_Count < _Size)
_Size = _Count;
_Traits::copy(pptr(), _Ptr, (size_t)_Size);
_Ptr += _Size;
_Copied += _Size;
_Count -= _Size;
pbump((int)_Size);
}
else if (_Traits::eq_int_type(_Traits::eof(),
overflow(_Traits::to_int_type(*_Ptr))))
break; // single character put failed, quit
else
{ // count character successfully put
++_Ptr;
++_Copied;
--_Count;
}
return (_Copied);
}
When I try running example 2, I get basically the same result, but instead of access denied, it says:
# ERR: Unknown MySQL server host '<happy face icon>' (0)
MySQL error code: 983600
(another run returned MySQL error code: 3998256).
The problems are coming up anytime I try to call the connect() function. Does anyone have any thoughts on what I could be doing wrong or how I could tweak things to get C++ Connector to work?
Thank you very much for your time.
Best regards,
Chris