Connecting with MySQL ROOT doesn't return TMySQLServer class

I am trying to use root for making an application which is going to provide global and local indexing for a distributed database system.

So to start I need to connect to a database to implement and test my algos for indexing.

My platform is currently windows 2003, with mysql 4.0 and root 4.x. and my code currently looks like this:

#include

“stdafx.h”
#include "e:\root\include\TSQLServer.h"
int

_tmain(int argc, _TCHAR* argv[])
{
TSQLServer * oSQLServer = (TSQLServer *)TSQLServer::Connect (“mysql://127.0.0.1:3306/test”,“root”,“1”);
TSQLResult *res;
res = oSQLServer->Query(“select * from emp”);
return 0;
}


The error which i am encountering is:

Error in TPluginHandler::SetupCallEnv: class TMySQLServer not found in plugin MySQL

Also I have already tested this table and database via other applications using OLEDB and everythings fine on the mysql side.

Kindly guide as to what should be my next step to resolve this error…

Kind Regards

Adnan Abid

Did you install ROOT with the MySQL option?
Check $ROOTSYS/lib for libMysql.so

If you do not find this library, reconfigure ROOT with, eg
./configure
–with-mysql-libdir=$HOME/mysql-standard-4.0.17-pc-linux-i686/lib
–with-mysql-incdir=$HOME/mysql-standard-4.0.17-pc-linux-i686/include

Rene

Hi Brun,

Thanks for your post…

Actually we have this dll installed on the system where we are writing this software. Also the test platform is currently windows due to our lack of capability in linux kdevelop debugging. However we will soon shift this project to a linus system. The error however still persists…

Today we debugged this call and found out that the following code
(in TObjArray.h) is where the problem occurs…

TObject *THashTable::FindObject(const char *name) const
{
// Find object using its name. Uses the hash value returned by the
// TString::Hash() after converting name to a TString.

Int_t slot = GetHashValue(name);
if (fCont[slot]) return fCont[slot]->FindObject(name);
return 0;
}

In the above code snippet, fCont[slot] variable refers to a null element, hence a failed fetch…

Please also shine some light on the root and mysql initialization for an application that is being developed on windows.

My Kindest Regards
Adnan

Hi,

Unfortunately the configure script is not quite correct for MySQL on windows.
In order to make it go properly you have to change config/Makefile.config to replace mysqlclient.lib by libmysql.lib and apply for a patch.

Index: config/rootrc.in

RCS file: /user/cvs/root/config/rootrc.in,v
retrieving revision 1.127
diff -r1.127 rootrc.in
442c442
< Plugin.TSQLServer: ^mysql: TMySQLServer MySQL “TMySQLServer(const char*,const char*,const char*)”

Plugin.TSQLServer: ^mysql: TMySQLServer RMySQL “TMySQLServer(const char*,const char*,const char*)”
Index: mysql/Module.mk
===================================================================
RCS file: /user/cvs/root/mysql/Module.mk,v
retrieving revision 1.9
diff -r1.9 Module.mk
26c26,29
< MYSQLLIB := (LPATH)/libMySQL.(SOEXT)


MYSQLLIB := (LPATH)/libRMySQL.(SOEXT)

MYSQLLIBEXTRA:= Ws2_32.lib
MYSQLLDFLAGS := -NODEFAULTLIB:LIBCMT.lib
41c44
< “(SOFLAGS)" libMySQL.(SOEXT) @ "(MYSQLO) $(MYSQLDO)” \


             "$(SOFLAGS)" libRMySQL.$(SOEXT) $@ "$(MYSQLO) $(MYSQLDO)" \

Cheers,
Philippe.