Re: [Brahms-dev-l] More on rundb question

From: Catalin Ristea <ristea_at_nbi.dk>
Date: Tue, 18 Jul 2006 12:14:35 +0200
  Hi Steve,

  The way to change the host for databases could be like this:
  change the maindb host, like you did,

  mainDb->SetHostName("brahms-db0.rcf.bnl.gov");

  but then is coming the trick: the maindb contains a table called DB, which stores the host for the calibdb, FILECATALOG, geomdb and runsdb, which are actually the hosts considered for the respective databases. I don't think you could change this by any bratmain script command like
	
	BrRunsDb * runDb = BrRunsDb::Instance();
	runDb->SetDbName("RUNDB");
	runDb->SetHostName("brahms-db0.rcf.bnl.gov");

  So, the way without changing the brat would be to update the DB table on the main host to look something like below, which is not a big thing, since you are doing the whole story because you want to change the database server.

hilux19//~> mysql -u query -h ristea.priv.nbi.dk
mysql> use BrahmsMain;
mysql> select * from DB;
+--------------+------------------------+-------------+
| name         | host                   | file        |
+--------------+------------------------+-------------+
| calibrations | ristea.priv.nbi.dk     | BrahmsCalib |
| runs         | ristea.priv.nbi.dk     | RUNDB       |
| geometries   | ristea.priv.nbi.dk     | BrahmsGeom  |
| filecatalog  | brahms-db0.rcf.bnl.gov | FILECATALOG |
+--------------+------------------------+-------------+
4 rows in set (0.00 sec)

  And finaly, you have to add the corresponding lines into the .bratdbrc, so that you don't have to supply each time the passwords...

  I've only explained here the way I handle these sort of things, which could not be the right way, but it's an alternative. I hope it could help you.

Kind regards,
Catalin.


On Tuesday 18 July 2006 00:48, Stephen Sanders wrote:
> So... I've installed swish-e in my home directory.
> I've searched the archives and located Flemming's relevant message:
> http://www.sdcc.bnl.gov/brahms/private/list_hyper/brahms-dev-l/
> 4036.html
>
> What is suggested there doesn't work:
>
> My
> code...............................................................
>..... .................
>    BrMainDb * mainDb = BrMainDb::Instance();
>    mainDb->SetUserName("query");
>    mainDb->SetHostName("brahms-db0.rcf.bnl.gov");
>    mainDb->SetDbName("BrahmsMain");
>    if (!mainDb->Connect()) {
>      Error("CentMacro", "No connection to %s",
> mainDb->GetDbName()); return;
>    }
>    cout<<"connected to mainDb"<<endl;
>    if (!mainDb->ConnectToCalib()) {
>      Error("CentMacro", "No connection to calib DB");
>      return;
>    }
>    if (!mainDb->ConnectToGeom("query")) {
>      Error("CentMacro", "No connection to geom DB");
>      return;
>    }
>    BrRunsDb * runDb = BrRunsDb::Instance();
>    runDb->SetDbName("RUNDB");
>    runDb->SetHostName("brahms-db0.rcf.bnl.gov");
>    runDb->SetUserName("query");
>
>    if (!mainDb->ConnectToRun("query")) {
>      Error("CentMacro", "No connection to run DB");
>      return;
>    }
>    cout<<"Connected to runDB"<<endl;
>
>
> The
> results............................................................
>..... brat [0] .L MultCheck.C
> brat [1] MultCheck(12224)
> Warning: Automatic variable FlSi is allocated MultCheck.C:117:
> Warning: Automatic variable Si is allocated MultCheck.C:118:
> Warning: Automatic variable Tile is allocated MultCheck.C:119:
> connected to mainDb
> Error in <TMySQLServer::TMySQLServer>: connection to database RUNDB
> on brahms-rundb0.brahms.bnl.gov failed (error: Can't connect to
> MySQL server on 'brahms-rundb0.brahms.bnl.gov' (110))
> Error in <BrRdbmDb::Connect>: User query couldn't connect to
> database RUNDB @ brahms-rundb0.brahms.bnl.gov
> Error in <BrRdbmMainDb::ConnectToDb>: couldn't connect to database
> RUNDB Error in <CentMacro>: No connection to run DB
>
> _______________________________________________
> Brahms-dev-l mailing list
> Brahms-dev-l_at_lists.bnl.gov
> http://lists.bnl.gov/mailman/listinfo/brahms-dev-l

-- 
Catalin Ristea---------------------------------
High Energy and Heavy Ions Group
Niels Bohr Institute
Blegdamsvej 17, 2100 Copenhagen, Denmark
Tel (+45) 35 32 54 04 / Fax (+45) 35 32 50 16

E-mail: catalin.ristea_at_nbi.dk
http  : www.nbi.dk/~ristea
-----------------------------------------------

_______________________________________________
Brahms-dev-l mailing list
Brahms-dev-l_at_lists.bnl.gov
http://lists.bnl.gov/mailman/listinfo/brahms-dev-l
Received on Tue Jul 18 2006 - 06:17:33 EDT

This archive was generated by hypermail 2.2.0 : Tue Jul 18 2006 - 06:17:52 EDT