List:MySQL++« Previous MessageNext Message »
From:Thomas Volckhausen Date:November 22 2009 4:58pm
Subject:Re: VS2008 Examples Don't Connect Unless Windows Service Is Started Up?
View as plain text  
Thanks to everybody for their answers, I did some more digging and made more sense of my
original question and answered it at least in my own mind, and I wanted to pass this on
to the list.

I needed to update an existing Windows application that used mysql++ to provide both the
Mysql client and server inside the application. Turns out that if mysql++ is built and
linked against the mysqld.lib and the C:\Program Files\MySQL\MySQL Server
5.1\Embedded\DLL directory of the local MYsql installation, then mysql++ will use the
embedded server to access local databases rather than requriing the server to operate as
a separate process.

When I downloaded the mysql++ package and examples, they are set up to buildi against the
standard mysql client so they only work when a separate server process is running.

Using  mysql++ with the MysSQL  embedded server does not seem to be used to much, and I
hope it is supported in future mysql++ releases.


Here is a cut-and-paste from mysql.h referrring to the regular client and embedded server
libraries.
/*

Set up and bring down the server; to ensure that applications will

work when linked against either the standard client library or the

embedded server library, these functions should be called.

*/

int STDCALL mysql_server_init(int argc, char **argv, char **groups);

void STDCALL mysql_server_end(void);

/*

mysql_server_init/end need to be called when using libmysqld or

libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so

you don't need to call it explicitely; but you need to call

mysql_server_end() to free memory). The names are a bit misleading

(mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general

names which suit well whether you're using libmysqld or libmysqlclient. We

intend to promote these aliases over the mysql_server* ones.

*/

#define mysql_library_init mysql_server_init

#define mysql_library_end mysql_server_end

Thanks Again,

Tom

  ----- Original Message ----- 
  From: Attila<mailto:atteeela@stripped> 
  To: Thomas Volckhausen<mailto:TomVolckhausen@stripped> ; Adam
Nielsen<mailto:adam.nielsen@stripped> ;
plusplus@stripped<mailto:plusplus@stripped> 
  Sent: Thursday, November 19, 2009 6:05 PM
  Subject: Re: VS2008 Examples Don't Connect Unless Windows Service Is Started Up?


  "embedded mysql" server?
  That sounds new to me.

  I thought that the dll was for access the mysql api.... Not that there
  is any server running somewhere.

  Could it be that in your previous installation had 2 running mysql
  instance and they would conflict...hence why you had to shut one down
  to get the examples to work?



  On 11/19/09, Thomas Volckhausen
<TomVolckhausen@stripped<mailto:TomVolckhausen@stripped>> wrote:
  > In my previous mysql++ installations I believe that mysql++ was using the
  > libmysqld.dll (the embedded server that it had linked to) to access the
  > mysql database. So in this case, users could run my mysql++ using
  > applications without starting the Mysql Windows Service.
  >
  > And for these previous installations, running the Windows service version
  > (C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld) would block mysql++
  > access to the database causing the mysql++ using application to hang until
  > the Windows service was halted.
  >
  > Only in the VS2008/mysql++ 3.0.9 case the applications require the Windows
  > Service to be running, which will not be the case on the systems of users
  > who have the mysql++ using applications installed on their systems.
  >   ----- Original Message -----
  >   From: Adam
Nielsen<mailto:adam.nielsen@stripped<mailto:adam.nielsen@stripped>>
  >   To: Thomas
Volckhausen<mailto:TomVolckhausen@stripped<mailto:TomVolckhausen@stripped>>
  >   Cc:
plusplus@stripped<mailto:plusplus@stripped<mailto:plusplus@stripped%3Cmailto:plusplus@stripped>>
  >   Sent: Thursday, November 19, 2009 5:11 PM
  >   Subject: Re: VS2008 Examples Don't Connect Unless Windows Service Is
  > Started Up?
  >
  >
  >   > 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.
  >
  >
  >   --
  >   MySQL++ Mailing List
  >   For list archives:
  >
http://lists.mysql.com/plusplus<http://lists.mysql.com/plusplus<http://lists.mysql.com/plusplus%3Chttp://lists.mysql.com/plusplus>>
  >   To unsubscribe:
  > http://lists.mysql.com/plusplus?unsub=1
  >
  >

  -- 
  Sent from my mobile device

  Attila
  Software Developer
  atteeela@stripped<mailto:atteeela@stripped>

  -- 
  MySQL++ Mailing List
  For list archives:
http://lists.mysql.com/plusplus<http://lists.mysql.com/plusplus>
  To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1


Thread
VS2008 Examples Don't Connect Unless Windows Service Is Started Up?Thomas Volckhausen20 Nov
  • Re: VS2008 Examples Don't Connect Unless Windows Service Is StartedUp?Adam Nielsen20 Nov
    • Re: VS2008 Examples Don't Connect Unless Windows Service Is StartedUp?Warren Young20 Nov
  • Re: VS2008 Examples Don't Connect Unless Windows Service Is Started Up?Thomas Volckhausen20 Nov
    • Re: VS2008 Examples Don't Connect Unless Windows Service Is Started Up?Attila20 Nov
  • Re: VS2008 Examples Don't Connect Unless Windows Service Is Started Up?Thomas Volckhausen22 Nov
    • Re: VS2008 Examples Don't Connect Unless Windows Service Is Started Up?Warren Young23 Nov