libmysqld.dll - any working example?

J

JZ

Does anybody know any working example of using embedded MySQL library
for Win32 (libmysqld.dll)? That example from MySQL manual does not
work for me. I am looking for Python API to libmysqld.dll...
 
J

JZ

You may want to consider this, which doesn't require you to ship any
external DLLs:
http://sourceforge.net/projects/mysql-python

No, you did not understand me. I know this library and I have been
using it for a long time. But the problem is I want to move my web
(pythonic) application to CD and I wanted it to work with MySQL as a
DLL library. I do not want to install full mysql serwer.
I know how to use MySQLdb connection for a server, but I do not know
how to connect to that dll. If MySQLdb can do this I do not know how
use it. (MySQLdb.Connect() method has parameters of host, login but
libmysql.dll do not need such parameters.)
 
D

Dennis Lee Bieber

JZ fed this fish to the penguins on Wednesday 26 November 2003 03:30 am:
Does anybody know any working example of using embedded MySQL library
for Win32 (libmysqld.dll)? That example from MySQL manual does not
work for me. I am looking for Python API to libmysqld.dll...
If I understand my book (hmmm, looks like New Riders has been
swallowed by SAMS and renamed to "Developer's Library"), that DLL would
have to be specified to the linker in place of the regular client
protocol library. If so, to get Python to use it will likely require
rebuilding the MySQLdb modules changing the linkage option.

--
 
J

JZ

If I understand my book (hmmm, looks like New Riders has been
swallowed by SAMS and renamed to "Developer's Library"), that DLL would
have to be specified to the linker in place of the regular client
protocol library. If so, to get Python to use it will likely require
rebuilding the MySQLdb modules changing the linkage option.

Do you know how to rebuild this module using Visual Studio 7 instead
of v6? Is it possible?
 
J

JZ

If I understand my book (hmmm, looks like New Riders has been
swallowed by SAMS and renamed to "Developer's Library"), that DLL would
have to be specified to the linker in place of the regular client
protocol library. If so, to get Python to use it will likely require
rebuilding the MySQLdb modules changing the linkage option.

I recompiled MySQLdb but I still do not know how to connect to embed
server... :( MySQL.Connect(host=...)???? There is no example nor
explanation. Not at all.
 
J

Joe Francia

JZ said:
Do you know how to rebuild this module using Visual Studio 7 instead
of v6? Is it possible?

Unless you're totally married to MySQL, you may want to consider using
one of the embeddable databases for Python, such as Sleepycat's
Berkeley, Metakit, PySQLite, Kinterbase, etc. I've used Berkeley,
Metakit and PySQLite, and they're all very good, each serving somewhat
different needs. Shouldn't be too much effort to pull the data out of
MySQL and into something else.

Peace,
Joe
 
J

JZ

Unless you're totally married to MySQL, you may want to consider using
one of the embeddable databases for Python, such as Sleepycat's
Berkeley, Metakit, PySQLite, Kinterbase, etc. I've used Berkeley,
Metakit and PySQLite, and they're all very good, each serving somewhat
different needs. Shouldn't be too much effort to pull the data out of
MySQL and into something else.

I do not want to use other database because my application *have to*
work in full mysql server *and* (with _very_ little effort) with embed
sql *without changing any sql queries*. It is multiplatform
application (MySQL/Linux & MSSQL2k/Win32) I thought about SQlite, but
it is no compatible with some queries. and I do not want to parse them
with regular expressions.

I checked mysql.h and I found the following piece of code:

/*
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);

Those functions seems to be *no implemented* in MySQLdb (I could not
find them in _mysql.c file) :(

If I understood the comment above, MySQLdb could be compiled with
standard client library or with embed server library - not with both
of them, right? :(
 
D

Dennis Lee Bieber

JZ fed this fish to the penguins on Friday 28 November 2003 17:51 pm:

Do you know how to rebuild this module using Visual Studio 7 instead
of v6? Is it possible?
Sorry, all I have is the training wheels edition of VC6 (IE, the
nagware executable type). I've always relied upon the pre-built files
when I can find them.


--
 
D

Dennis Lee Bieber

JZ fed this fish to the penguins on Saturday 29 November 2003 01:07 am:
If I understood the comment above, MySQLdb could be compiled with
standard client library or with embed server library - not with both
of them, right? :(

According to the book I have, the "final application" would have to be
linked to one or the other; the calls made are the same, those that
don't mean anything in one form are no-ops.

For Python usage, I hypothesize that one could possibly build a
version of MySQLdb (recommend modifying the name... maybe call it
MySQLdbe for embedded) linking to the second library. Changing the
import statement /should/ then be all that is needed to change
libraries. (I suspect it is much too late to make MySQLdb a package
with .client and .embedded subparts.)

Getting someone to actually /do/ the work of dual builds is another
matter. Hopefully the link is not tied to any particular library
version.

--
 
D

Dennis Lee Bieber

JZ fed this fish to the penguins on Friday 28 November 2003 19:15 pm:

I recompiled MySQLdb but I still do not know how to connect to embed
server... :( MySQL.Connect(host=...)???? There is no example nor
explanation. Not at all.
Looks like there may be a few extra steps needed... Stuffed into the
MySQLdb build system...

I'm hacking quickly through this book (note that the embedded option
is new with MySQL 4, probably why it hasn't appeared beforehand in this
group).

1 add mysql_embed.h to the set of MySQL header files used...

2 modify the client_groups array... (their example assumes a program
called embapp)
static const char *client_groups[] =
{
"client", "embapp", NULL
};
modify server_groups
static const char *server_groups[] =
{
"server", "embedded", "embapp_SERVER", NULL
}; /* embapp is name of application */

3 call mysql_server_init()
suggested to place just before the mysql_init() call

4 call mysql_server_end()
just after the mysql_close() call


There is also a warning that your application should not be accessing
the same database directory as any other server on the machine.

The mysql_server_* calls are do-nothings if you link with the regular
client library, so once the above is done you can switch back by just
relinking.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top