views:

48

answers:

2

I am trying to connect to a database using MySQL C++ Connector. I have used this code segment many times:

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

and it has worked successfully, but now I am getting this error thrown from this code segment:

"Unknown MySQL server host 'ÇD$Œþ' (11001)"

All that I can find online is relating to using the wrong hostname there so I don't know where this error could be coming from. I'm compiling under Debug mode in Visual Studio 2005 and I'm in a MFC project, if that helps any. Does anyone have any ideas for how to resolve this?

Thanks so much for your time!

A: 

Looks like a unicode issue. Is this an exact copy-paste from your source or did you re-type it? It's possible visual studio messed up the encoding in your source file, or something might be forcing the MySQL driver to interpret your host as a wide string, when it's not.

Ken Simon
It's an exact copy and paste. And yeah, a messed up character setting is kind of my impression too, but I can't quite figure it out. Maybe I will retype my source file.
laurenelizabeth
No luck with retyping :( I'm going to keep trying other things though. Thanks for your help!
laurenelizabeth
A: 

After much struggling trying to fix character sets, I fixed it by using Connector/NET instead. This forum post:

http://www.velocityreviews.com/forums/t713739-mysql-connector-driver-behaviour-with-visual-c-clr-cli-project.html#post4126062

lead me in the right direction.

laurenelizabeth