Hi Sven, You must have a TApplication (or TRint). See example in ROOT main program or the test programs. Rene Brun On Sun, 13 Oct 2002, Sven A. Schmidt wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > I'm using the TSQL* classes to connect to and query a mysql database. I > have the following code in 'test.cc': > > - ------------------------------------------------------------------------ > #include <TSQLServer.h> > #include <TSQLResult.h> > #include <iostream.h> > > int main() { > TSQLServer *db = TSQLServer::Connect( "mysql://localhost/mydata", > "user", "password" ); > TSQLResult *res = db->Query( "select * from theData" ); > TSQLRow *row; > cout << "rows: " << res->GetRowCount() << endl; > } > - ------------------------------------------------------------------------ > > When I load this in the interpreter ( ".L test.cc" ) and run it by > calling "main()", I get the expected row count. > > But when I compile the file like this: > g++ -g -O -Wall -fPIC `root-config --cflags` `root-config --libs` > `root-config --glibs` \ > -o test test.cc > and then run the resulting binary, it just sits there, trying to > connect to the db. It never gets to the query line. > > The platform is MacOSX 10.2, root version is 3.03.09, MySQL version is > 3.23.51. > > What is the difference in the compiled and the interpreted version of > the DB access? > Has anyone experienced (and solved?) the same problem? > > Cheers, > Sven > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.7 (Darwin) > > iD8DBQE9qdVxVpUkGuwnAeURAoeZAKCvlSa13vR66YCS5mQ+HBW0cnX5SgCgtpAv > ndgia+NbVzCVYfrkVLkcrnw= > =dHEE > -----END PGP SIGNATURE----- >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET