> But the examples only connect to mysql if the "C:\Program
> Files\MySQL\MySQL Server 5.1\bin\mysqld" windows service is started
> up. Otherwise I get a connection failure like the following
> command-line text:
>
> C:\Documents and Settings\User\My Documents\My
> Downloads\mysqlplusplus\Copy of Copy of mysql++-3.0.9>exrun simple2
> -u mysqlpp_test -p nunyabinness DB connection failed: Can't connect
> to MySQL server on 'localhost' (10061)
That makes sense. You're trying to connect to a database server on your
local PC, but there is no database server running, hence "can't connect".
> If I start up the Mysql windows service I get the following
> successful result from the command-line:
>
> C:\Documents and Settings\User\My Documents\My
> Downloads\mysqlplusplus\Copy of Copy of mysql++-3.0.9>exrun simple2
> -u mysqlpp_test -p nunyabinness Item Num
> Weight Price Date
>
> N??rnberger Brats 97 1.5 8.79
> 2005-03-10 Pickle Relish 87 1.5 1.75
> 1998-09-04 Hot Mustard 73 0.95 0.97
> 1998-05-25 Hotdog Buns 65 1.1 1.10
> 1998-04-23
Now you are running a database server on your PC, so there is something
to connect to and retrieve data.
> In general my applications will not have the mysql windows service
> runnning, so does anyone know what switch/setting/etc. I need to
> modify to make the examples (and any other VS2008 mysql++ 3.0.9
> application ) connect to the database without having the mysql
> Windows service running??
I'm not sure I understand - you need to connect to a MySQL server
somewhere, be it on your local machine or an external server. If your
server is not on your local PC, change 'localhost' to point to the
server name.
Cheers,
Adam.