Using Other Database - MySql
This page provides a general guideline of how to integrate and configure lexical tools with other database, such as MySql. An open source database, MySql, is illustrated as an example. Users may skip this page if they use the installation script to install their Lexical tools with the default database (HSqlDb). We recommend using the default embedded HSqlDb unless using other database is a must in your project. The option of MySql installation scripts is not provided in the Lexical Tools distribution after 2012 release.
Follow the instructions on Lexical Tools Installation Instructions to complete the installation of lexical tools.
Installation
2.1 Requirements
A running database with following specifications is needed to run lexical tools with this option. Please consult to your database administrator if you have questions.
2.2 Procedures
Consult with your DBA if you have any questions
2.3 Example: MySql
MySql is one of the most popular open source databases. We use it as an example for this option. Bellows are required information:
Also create the user account and database for lvg:
Create a user account:
Create a database:
2.4 Sample Script:
You might need your DBA to help you on setting up user account and database for lvg. The program and shell scripts of HSqlDb provided with lvg package can be used as reference for this step. However, you need to modify the program and script and create your own. Once you created and modified your programs in ${LVG_DIR}/loadDb/sources/gov/nih/nlm/nls/lvg/loadDb/MySql, you need to
Also, the programs and scripts for MySql was provided in Lvg.2012- and can be used as another reference.
Up to this point, users should have:
3.1 DB tables and data files
There are 9 major tables to be created and loaded into database. Each of the tables below needs to be created and loaded. The directory for these data files is: ${LVG_DIR}/data/tables/*
Table Name | Source Data File | Total Records | Create and Load Table | Check data |
---|---|---|---|---|
Inflection | ${LVG_DIR}/data/tables/inflection.data | 1,923,235 | LoadInflection | CheckInflection |
Synonym | ${LVG_DIR}/data/tables/synonyms.data | 282,602 | LoadSynonym | CheckSynonym |
Acronym | ${LVG_DIR}/data/tables/acronym.data | 296,860 | LoadAcronym | CheckAcronym |
ProperNoun | ${LVG_DIR}/data/tables/properNoun.data | 18,725 | LoadProperNoun | CheckProperNoun |
Derivation | ${LVG_DIR}/data/tables/derivation.data | 158,409 | LoadDerivation | CheckDerivation |
Antonyms | ${LVG_DIR}/data/tables/antonyms.data | 13,076 | LoadAntonym | CheckAntonym |
Nominalization | ${LVG_DIR}/data/tables/nominalization.data | 35,712 | LoadNominalization | CheckNominalization |
Canonical | ${LVG_DIR}/data/tables/canonical.data | 1,931,674 | LoadCanon | CheckCanon |
Fruitful | ${LVG_DIR}/data/tables/fruitful.data | 6,430,245 | LoadFruitful | CheckFruitful |
AntiNorm | ${LVG_DIR}/data/tables/antiNorm.data | 2,470,793 | LoadAntiNorm | CheckAntiNorm |
Please notes that the last two columns are names of Java programs used to create DB tables, load data into database, and check loaded table. Users may find
source codes for loading and checking data in HSqlDb are under
${LVG_DIR}/loadDb/sources/gov/nih/nlm/nls/lvg/loadDb/HSqlDb.
These Java source codes can be used for HSqlDb (or other database) with minor modifications.
Both ${LVG_DIR}/loadDb/lib/lvgLoadDb.jar and ${LVG_DIR}/lib/lvg${YEAR}.jar contain all Java classes for these files.
3.2 Procedures
3.3 Example: MySql
This section describes procedures of loading data into 9 DB tables in MySql database as follows:
This paragraph describes steps to run java programs of LoadXxx and CheckXxx.
Users may run CheckXxx (similar setup steps as above) to check and perform queries to table Xxx to make sure all tables are created and loaded correctly.
3.4 Sample Scripts
There are two scripts are provided to ease the processes of loading and checking data in the database:
2 3
4.1 Configuration file
The default configuration file is at ${LVG_DIR}/data/config/lvg.properties. You will need to modify the configuration file to use
4.2 JDBC Driver
Add your JDBC driver to CLASSPATH
4.3 Example: MySql
Use MySql as example, there are two way to set up in the configuration, as described bellows:
or
In addition, users need to add JDBC driver to classpath. For examples, add ${LVG_DIR}/lib/jdbcDrivers/MySql/mysql-connector-java-3.1.8-bin.jar to ${LVG_DIR}/bin/norm if you want to run norm.
Now, Lexical Tools are ready to run with MySql database
4.4 JDBC & ports: