Using Other Database - MySql
This page provides details of how to integrate and configures LexAccess tool data into a pre-existing MySql database. This page can also be used as reference to use other database servers at users' own risk. It is recommended to use the installation script to install LexAccess tool with the default HyperSonic database. If such option is chosen, users may skip this page.
As an additional option, LexAccess Java provides users the option of using another database, such as MySql, to fit in user's need in their applications. In other words, LexAccess allows users to select other databases through JDBC. To use these database options, users need to set up appropriate variables in the configuration file, create two LexAccess related tables and load them into the database. This page uses MySql as an example to illustrate these steps:
Users may choose other databases for LexAccess only if all related tables are created and loaded with data in the database appropriately.
I. Setup MySql
MySql, provided by MySQL AB, is one of the most popular Open Source databases. The LexAccess tool Java uses the following versions of the MySql and its JDBC driver:
If you have used and installed MySql, you may skip the preceding step.
Create a user account for LexAccess:
Create a database for LexAccess:
Script Example:
You might need your DBA to help you on setting up user account and database for lexAccess. However, there is a shell script provided with lexAccess package to ease this step.
Up to this point, users should have installed the MySql database, created a database in it called lexAccess2023, and opened an account with lexAccess as both username and password.
II. Create and load tables into MySql
There are 2 major tables to be created and loaded into MySql. Each of the tables below needs to be created and loaded. The directory for these data files is: $LA_DIR/data/tables/
Table Name | Source File | Records |
---|---|---|
INFL_VARS | $LA_DIR/data/tables/inflVars.data | 1,658,160 |
LEX_RECORD | $LA_DIR/data/tables/lexicon.data | 469,992 |
Please Note that the source codes for loading and checking data into MySql are under $LA_DIR/loadDb/sources/gov/nih/nlm/nls/lexAccess/loadDb/MySql. Both
Load data
Users need to run LoadXXX for both 2 tables. The Java program LoadXXX will:
To load these tables, users need to:
Check data
This step is optional. 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 appropriately.
Script Examples:
There are two scripts are provided to ease the processes of loading and checking data in the database:
2 3
At this point, all lexAccess data are loaded into created tables in the database.
III. Configure MySql in LexAccess
Location of configuration file:
Change the setup in the configuration file
There are two ways to setup the MySql database, as shown below:
or
Make sure the JDBC driver is included in classpath. For examples, edit file $LA_DIR/bin/lexAccess and modify (fill in) the value to JDBC
Now, the LexAccess Tool is ready to run with MySql database
IV. Use different port number for MySql in LexAccess
The default port of MySql is 3306. In case that different port number (for example, 3307) is used in your MySql database, you will need to add the port number after the database host (localhost:3307).