Re: [ROOT] MySQL and ROOT

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Jun 28 2002 - 01:01:26 MEST


Hi Tony,

  for me it works fine, in one of my example programs I have:

   const char *dbname;
   if (!strcmp(gSystem->HostName(), "pcsalo.cern.ch"))
      dbname = "mysql://localhost/mdc";
   else
      dbname = "mysql://pcsalo.cern.ch/mdc";

   TSQLServer *db = TSQLServer::Connect(dbname, "<user>", "<passwd>");

It might be an issue with the mysql access permission that have to be
set for localhost. Why it is not an issue with perl I don't know, but
would like to know.


Cheers, Fons.


On Wed, 2002-06-26 at 22:03, Timothy E Miller wrote:
> Hey ROOT-ers,
> 
> Here's the scenario:
> 
> I use a perl script to fill a MySQL database, accessing
> the database via:
> 
> my $dbh = DBI->connect("DBI:mysql:database=dbname;host=localhost",
>                        "username", "mypasswd");
> 
> I am able to store and fetch information without any problem in
> perl.
> 
> However, when I switch over to ROOT, I have difficulties.  I
> can not access the database via localhost.  I have to specify
> the hostname and, since I'm on a laptop, have to insert my
> network card so that it can connect to the hostname.
> 
> Here's the ROOT access line:
> 
> TSQLServer *phenix =
>    TSQLServer::Connect("mysql://gateway:3306/phenix","username","password");
> 
> (The gateway hostname works, localhost does not)
> 
> I'm a little perplexed at why localhost doesn't work and
> haven't had much luck on documentation?  Is there better
> documentation than the Class Reference pages for the
> MySQL support?
> 
> I've tried to check all (I think) the obvious network problems
> but seriously doubt it is network related since the perl script
> works just fine (with and without network card in for both
> localhost and hostname).  What am I missing?
> 
> And before you think that I've forgotten...I've tried it on
> both 3.02.07 and 3.03.06 (gcc 296, Linux).
> 
> Thanks,
> -Tim Miller
> 
> -- 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Timothy E. Miller       RHIC:  PHENIX Experiment
> Post-Doctoral Res Assoc  AGS:   E864, E941
> Vanderbilt University   Email: tim@bnl.gov
> 
> 
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:58 MET