List:MySQL++« Previous MessageNext Message »
From:John Gehring Date:December 28 2007 7:01pm
Subject:Re: a simple question:embedded server
View as plain text  
I'm using the embedded server in a project that is still under 
development (not in production, yet). It seems to be working pretty well 
with a couple of troubling exceptions...hmmm, wrong word to use here; a 
couple of issues. In the log file <name>.err, I see a lot of:

"InnoDB: Database was not shut down normally!"

At this point, I haven't associated that error with any kind of database 
corruption, but I plan on getting to the bottom of that message sooner 
or later.

Also, upon initiating the embedded server, I've noticed that the 
Connection ctor calls mysql_init(), which calls mysql_server_init(). 
However, the MySQL documentation for 5.1 states that mysql_server_init() 
is deprecated and should be replaced with mysql_library_init(). I'm 
using the mysql++-2.3.2 code base, so I think I'm up to date there. I 
don't know yet what I'm missing out on by having mysql_server_init() 
called instead of the more current mysql_library_int() and that issue is 
still on my list of things to look at.

Regarding my implementation, I'm using visual studio 2005 Pro Edition. 
I've written a c++ DLL that implements a group of specific queries 
against a local database. My data class has a mysqlpp::Connection 
object. In the ctor, I call:

mySQLConn.connect(<database name>, <host name>, <user name>,
Then I make calls for queries and such just as I'm sure the rest of you 
work against a regular server. So I don't think I'm doing anything 
different at all, with the exception of how I link.

Obviously, I link against libmysqld (in ./MySQL 5.1/Embedded/DLL/debug), 
and in theory, I should be able to change that linkage to libmysql so 
that I can run the application against a local server (daemon) if I 
want. That's another step on my to-do list that I haven't gotten to yet.

One other thing; the my.ini file. What I've ended up doing, which may or 
may not be optimal, is placing the my.ini file in a directory one level 
up from where the executable file is located. Then in the [server] 
section, I add the basedir, datadir, and language variables. Doing this 
rather than using the my.ini file in the %windir% or c:\ or couple of 
other default locations allows different database clients (embedded 
server applications) to access their own my.ini file. Also, and my 
memory is a little foggy on this, I set the variable 
innodb_log_file_size equal to 100M. I think what was happening was that 
the default log file sizes were different between the embedded server 
and the daemon server process (of which only one or the other can run at 
a time). So if I created a database using the daemon, the embedded 
server choked on opening up the database and vice versa.

Hope this helps.

John G

Warren Young wrote:
> ??? wrote:
>> Does mysql++ support embedded server? 
> I'm not aware of anyone who's used it successfully.  I seem to recall 
> someone running into trouble with it in the past -- see the archives 
> -- but I didn't learn anything from it telling me that it can't be 
> done. So, the answer is "maybe".
> You may want to turn on the connection option to use the embedded 
> server.  In 2.3, it's Connection::opt_use_embedded_connection.  It'll 
> be different in v3, but the principle's the same.  The default is to 
> let the C API library guess, which it may not do successfully.
> Other than that, I don't know what special steps may be necessary 
> beyond linking your program to the embedded server.
> Please, let us know how it works out, good, bad or ugly.
a simple question:embedded server王颖明27 Dec
  • Re: a simple question:embedded serverWarren Young28 Dec
    • Re: a simple question:embedded serverJohn Gehring28 Dec