Configuring the Environment Variable
The following environment variables need to be set in order to use the CUBRID. The necessary environment variables are automatically set when the CUBRID system is installed or can be changed, as needed, by the user.
CUBRID Environment Variables
- CUBRID: The default environment variable that designates the location where the CUBRID is installed. This variable must be set accurately since all programs included in the CUBRID system uses this environment variable as reference.
- CUBRID_DATABASES: The environment variable that designates the location of the databases.txt file. The CUBRID system stores the absolute path of database volumes in the $CUBRID_DATABASES/databases.txt file. See databases.txt file.
- CUBRID_LANG: The environment variable that specifies the display language of utility usage or error messages in CUBRID. Currently, CUBRID provides English (en_US) and Korean (ko_KR.euckr and ko_KR.utf8). it is not a mandatory setting. Therefore, if the variable has not been set, then refer to the LANG environment variable or use en_US, which is the default value. See Language Setting.
- CUBRID_TMP: The environment variable that specifies the location where the cub_master process and the cub_broker process store the UNIX domain socket file in CUBRID for Linux. If it is not specified, the cub_master process stores the UNIX domain socket file under the /tmp directory and the cub_broker process stores the UNIX domain socket file under the $CUBRID/var/CUBRID_SOCK directory (not used in CUBRID for Windows).
CUBRID_TMP value has some constraints, which are as follows:
- Since the maximum length of the UNIX socket path is 108, when a path longer than 108 is entered in $CUBRID_TMP, an error is displayed.
$ export CUBRID_TMP=/home1/siwankim/cubrid=/tmp/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
$ cubrid server start apricot
The $CUBRID_TMP is too long. (/home1/siwankim/cubrid=/tmp/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789)
- When the relative path is entered, an error is displayed.
$ export CUBRID_TMP=./var $ cubrid server start apricot
The $CUBRID_TMP should be an absolute path. (./var)
CUBRID_TMP can be used to avoid the following problems that can occur at the default path of the UNIX domain socket that CUBRID uses.
- /tmp is used to store the temporary files in Linux. If the system administrator periodically and voluntarily cleans the space, the UNIX domain socket may be removed. In this case, configure $CUBRID_TMP to another path, not /tmp.
- The maximum length of the UNIX socket path is 108. When the installation path of CUBRID is too long and the $CUBRID/var/CUBRID_SOCK path that store the UNIX socket path for cub_broker exceeds 108 characters, the broker cannot be executed. Therefore, the path of $CUBRID_TMP must not exceed 108 characters.
The above mentioned environment variables are set when the CUBRID is installed. However, the following commands can be used to verify the setting.
For Linux :
% printenv CUBRID
% printenv CUBRID_DATABASES
% printenv CUBRID_LANG
% printenv CUBRID TMP
In Windows :
C:> set CUBRID
OS Environment and Java Environment Variables
- PATH: In the Linux environment, the directory $CUBRID/bin, which includes a CUBRID system executable file, must be included in the PATH environment variable.
- LD_LIBRARY_PATH: In the Linux environment, $CUBRID/lib, which is the CUBRID system’s dynamic library file (libjvm.so), must be included in the LD_LIBRARY_PATH (or SHLIB_PATH or LIBPATH) environment variable.
- Path: In the Windows environment, the %CUBRID%bin, which is a directory that contains CUBRID system’s execution file, must be included in the Path environment variable.
- JAVA_HOME: To use the Java stored procedure in the CUBRID system, the Java Virtual Machine (JVM) version 1.6 or later must be installed, and the JAVA_HOME environment variable must designate the concerned directory.
See the Environment Configuration for Java Stored Functions/Procedures.
Configuring the Environment Variable
If the CUBRID system has been installed on Windows, then the installation program automatically sets the necessary environment variable. Select [Systems Properties] in [My Computer] and select the [Advanced] tab. Click the [Environment Variable] button and check the setting in the [System Variable]. The settings can be changed by clicking on the [Edit] button. See the Windows help for more information on how to change the environment variable on Windows.
If the CUBRID system has been installed on Linux, the installation program automatically creates the .cubrid.sh or .cubrid.csh file and makes configurations so that the files are automatically called from the installation account’s shell log-in script. The following is the contents of .cubrid.sh environment variable configuration that was created in an environment that uses sh, bash, etc.
if [ "$ld_lib_path" = "" ]