How to use RefDB with a single database

The default RefDB setup asks for at least two databases: a system database called "refdb" by default, and at least one reference database. The former contains bibliography styles and the journal word list. The latter contains the reference data proper. Keeping system data and reference data in two separate databases is preferred because you can scrap and re-create reference databases anytime without affecting the system database.

However, there are situations where you must stick to a single database. This is often the case if you rent some webspace "with MySQL". The fineprint usually restricts this to a single MySQL database which is created by the internet provider. Is it still possible to run RefDB on such a database?

Since Subversion revision 235, the answer is yes. The feature will soon show up in the upcoming refdb-0.9.8-pre9 prerelease. The following is a step-by-step guide to set up RefDB with a single database, assuming you use MySQL (the commands are slightly different with other database engines, but the same procedure applies).

1. Configure and build RefDB
The ./configure script uses the option --with-main-db=dbname to set the name of the system database. Ask your provider for the name of "your" database and pass it to ./configure, along with any other options that you may need. Then run make && make install as usual.

2. Set up the database
Now you have to create the tables in the system database. RefDB ships SQL scripts for both the system database and for empty reference databases. First create the system database tables:

mysql -h <hostname> -u <username> -p <dbname> < /usr/local/share/refdb/sql/refdb.2.dump.mysql41

Then add the reference database tables to the same database:

mysql -h <hostname> -u <username> -p <dbname> < /usr/local/share/refdb/sql/empty.2.dump.mysql41

As both databases contain a "t_meta" table, the database engine may complain that the table already exists when it tries to create it. This error message can be safely ignored.

Update: The MySQL dumps drop existing tables before creating them. Therefore MySQL users need to run an additional command:

mysql -h <hostname> -u <username> -p <dbname> -e "INSERT INTO t_meta VALUES ('refdb', 'refdb', '0.9.8-pre8',2,UTC_TIMESTAMP, UTC_TIMESTAMP)"

Remember that the "2" in both filenames and in the additional mysql command denotes the database version. Later versions of RefDB may use higher version numbers, so you should always pick the highest version shipped with your current version of RefDB.

3. Configure refdbd and the clients
Finally you should edit your /usr/local/etc/refdb/refdbdrc configuration file and enter the hostname/IP address of your database engine. Your ~/.refdbcrc and related client configuration files (or the equivalent global files in /usr/local/etc/refdb/) should set the variable defaultdb to the name of the remote database.

4. Run RefDB
When using RefDB, you should not use the deletedb or createdb commands as these would also destroy the system tables in your single-database setup. Otherwise you can work with your reference and note data as usual.

Kommentare

Noch keine Kommentare

Mein Kommentar

Dieser Artikel ist geschlossen. Keine Kommentare mehr möglich.