Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning
titleDeprecated

This information has been deprecated. The best practice for connecting to a local database is using a db file with SQLite.

Overview

The HPS conditions database contains time-dependent detector information for use by reconstruction and analysis software.  The primary database is hosted at JLAB and is periodically replicated to SLAC.  The JLAB database is accessible only internally within jlab.org whereas the SLAC one is public and can be accessed from anywhere over the internet as long as the port is not blocked for outbound traffic. 

...

The restricted hpsuser account will be used to run local reconstruction or analysis jobs, but it will not have any privileges to change the database.

If you intend to run the reconstruction offline (or cannot have online access to jlab database on hpsdb.jlab.org), you also need to create the hps_run_db database (v2 is the most updated version), and grant access to it to your mysql user:

No Format
mysql> create database hps_run_db_v2;
mysql> GRANT SELECT ON hps_run_db_v2.* TO 'hpsuser'@'localhost';

 

Creating a Database Dump

You must acquire a SQL dump from the JLAB database which will be loaded locally.

...

If you do not have an account on the JLAB database and do not wish to have one created for you, then you must ask one of the HPS database administrators to create this file for you.

 

You can also dump the database from your local machine (if you have an internet connection), using the following command:

...

No Format
mysqldump --lock-tables=false -h hpsdb.jlab.org -h hpsuser -p hps_run_db_v2 > hps_run_db_v2.sql

beware Beware that this file is huge and the dump operation may require several minutes. 

Loading the SQL File

Next, assuming you have transferred the SQL file to your local computer, you can use the command line tool to load it into a local database.

...

If you plan not to use any network resource to run the reconstruction, before running it it is necessary to change the location of the hps_run_db_v2 database your machine points to, to prevent it to search for it over the network (on the hpsdb.jlab.org machine). To do so, you need to edit your RunManager.java file (located in run-database/src/main/java/org/hps/run/database) and fix the DEFAULT_CONNECTION_PARAMETERS instance, in which the name of the database and its location are hardcoded. Change the hpsdb.jlab.org machine name to your localhost (127.0.0.1), and arrange accordingly the username, its password and/or the database name, should this be needed to macth match with your mysql initial configuration.

...