Embedded MySQL and Innodb
am 07.09.2006 07:04:35 von Akhil Mehta--Next_1157605463---0-203.199.83.125-21268
Content-type: text/plain;
charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Hi all,
I have problem connecting to InnoDB database when using embedd=
ed MySQL.=0ATest program is unable to open 'mysql' database. I am getting f=
ollowing messages:
Able to initialise server=0AUnknown database 'mysql=
'=0Amysql_real_connect() failed
Test program source and envrionmental =
details are given below.
Environment details are:
======3D=
=================
Using mysql-4.1.21-wi=
n32, MS VC++ 6.0
* libmysqld.lib and libmysqld.dll are picked up from =
mysql-4.1.21-win32\Embedded\DLL\Release=0A* Database files (ibdata1, ib_log=
file0, ib_logfile1) are created with MySQL-4.1.21 Client/Server installed o=
n other computer and it consists of default databases "mysql" and "test" cr=
eated during MySQL-installation. I copied them in D:\MySQL.=0A* MySQL clien=
t/server instance is not running.
my.ini is available in C:\ directory=
and its contents are
==================
==================== =====3D=
===============
[client]=0A= 0Aport=3D3306=
=0Adefault-character-set=3Dutf8
[Mysqltst_SERVER]
port=3D3306=0Ab=
asedir=3D"C:/Program Files/MySQL/MySQL Server 4.1/"=0Adefault-character-set=
=3Dutf8=0Alanguage=3D"C:/Program Files/MySQL/MySQL Server 4.1/Share/English=
"=0Adefault-storage-engine=3DINNODB=0Adatadir=3D"D:/MySQL/"= 0Ainnodb_log_fi=
le_size=3D10M
Source code of test program:
========3D=
===================
=0A#include
/* this string is not used */=0A"--datadir=3DD:\\MySQL",=0A"--key_buffer_s=
ize=3D32M"=0A};
static char *server_groups[] =3D {=0A"embedded",=0A"se=
rver",=0A"Mysqltst_SERVER",=0A(char *)NULL=0A};
int main(void)=0A{=0AM=
YSQL *mysql ;
if (mysql_server_init(sizeof(server_args) / sizeof(char =
*),=0Aserver_args, server_groups))=0Aexit(1);
mysql =3D mysql_init(NUL=
L) ;=0Aprintf("Able to initialise server\n") ;
/* Use any MySQL API fu=
nctions here */
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "Mysqlt=
st_SERVER") ;=0Amysql_options(mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, 0);=
if(mysql_real_connect(mysql, NULL, NULL, NULL, <<<--- This is failing=
=0A"mysql", 0, NULL, 0) == NULL)=0A{=0Aprintf(mysql_error(mysql)) ;=0Ap=
rintf("\nmysql_real_connect() failed\n") ;=0Amysql_close(mysql) ;=0Aexit(1)=
;=0A}
mysql_server_end();
printf("Able to end server\n") ;
=
return EXIT_SUCCESS;=0A}
=0A- - - - - - - - -
Warning in Error lo=
g file:
060906 11:58:23 [Warning] Can't open and lock time zone table:=
Table 'mysql.time_zone_leap_second' doesn't exist trying to
live with=
out them
It seems this warning is again due to the fact that test prog=
ram is unable to open mysql database.=0A- - - - - - - - -
Build Log - =
If some one may find it useful.
--------------------Configuration: tes=
tcom - Win32 Release--------------------=0ACommand Lines=0ACreating tempora=
ry file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPE4.tmp" with contents=0A[=0A=
/nologo /MT /W3 /GX /O2 /I "C:\Program files\MySQL\MySQL Server 4.1\Include=
" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"
/Fp"Release/Mysqlcon=
..pch" /YX /Fo"Release/" /Fd"Release/" /FD /c=0A"C:\User\VC\Abhay\TestProjec=
ts\MySQLTst\File-1.c"=0A]=0ACreating command line "cl.exe @C:\DOCUME~1\ADMI=
NI~1\LOCALS~1\Temp\RSPE4.tmp"=0ACreating temporary file "C:\DOCUME~1\ADMINI=
~1\LOCALS~1\Temp\RSPE5.tmp" with contents=0A[=0Akernel32.lib user32.lib gdi=
32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut3=
2.lib uuid.lib
odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.l=
ib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut=
32.lib uuid.lib odbc32.lib odbccp32.lib libmysqld.lib /nologo /subsystem:co=
nsole /incremental:no
/pdb:"Release/Mysqlcon.pdb" /machine:I386 /out:"=
Mysqlcon.exe" /libpath:"C:\Program Files\MySQL\MySQL Server 4.1\lib"=0A".\R=
elease\File-1.obj"=0A]=0ACreating command line "link.exe @C:\DOCUME~1\ADMIN=
I~1\LOCALS~1\Temp\RSPE5.tmp"=0AOutput Window=0ACompiling...=0AFile-1.c=0ALi=
nking...
Results=0AMysqlcon.exe - 0 error(s), 0 warning(s)=0A- - - - -=
- - - -
Can anyone suggest the possible cause of the problem?
Th=
anks in advance,=0AAkhil
--Next_1157605463---0-203.199.83.125-21268--