The Types of Error and Log Generated by CUBRID

posted Jul 13, 2020

Author: Changhwee Kim


In order to solve various problems encountered when developing and operating services on CUBRID, it is important to interpret error codes (messages) and to interpret various logs generated by the server.


In this article, rather than focusing on interpretation, let's first look at what kind of error codes (messages) and what kind of logs are generated based on CUBRID 9.3. I will explain about the interpretation in the future article.


The types of error codes that can be referred to when developing a service using C or JAVA are as shown in the table below, and by utilizing this, you can develop a program that enables branching according to various conditions Source Debugging.


Type of error code that occur:

  1. API related messages

1-1. CCI error Codes

CUBRID provides the C Client Interface (CCI) for C-based application development and returns a negative value when an error occurs.


The error code separation rules that occur are as follows:

- 20002 to -20999 : Error code occurred by CCI API function

- 10000 to -10999 : Error code occurred by CAS.

- 20001 : Error code occurred by database server


Please refer to the URL below for more information: 


1-2. JDBC Error Codes

CUBRID provides a JDBC driver (cubrid_jdbc.jar) for Java-based application development. CUBRID JDBC driver was developed based on the 2.0 specification and the installation location is in the <CUBRID installation directory>/jdbc directory; it is provided by default compiled in JDK 1.6.


JDBC error codes which occur in SQLException are as follows. All error codes are negative:

-21001 ~ -21999: Error code occurred by CUBRID JDBC methods

-10000 ~ -10999: Error code occurred by CAS and transferred by JDBC methods

-0 ~ -9999: Error code occurred by the database server


Please refer to the URL below for an example of outputting the error code and error message:


1-3. Database Server Errors 

Database server error processes use the server error code when an error has occurred. A server error can occur in any task that uses server processes. For example, server errors may occur while using the query handling program or the CUBRID utility.


When you write a C code with CCI driver, we recommend you to write a code with an error code name than with an error code number. For example, the error code number for violating the unique key is -670 or -886, but users can easily recognize the error when it is written as ER_BTREE_UNIQUE_FAILED or ER_UNIQUE_VIOLATION_WITHKEY.


However, when you write a JAVA code with JDBC driver, you have to use error code numbers because "dbi.h" file cannot be included into the JAVA code. For JDBC program, you can get an error number by using getErrorCode() method of SQLException class.


Please refer to the URL below for more information:


1-4. CAS Errors 

CAS error is an error which occurs in broker application server(CAS), and it can happen on all applications which access to CAS with drivers. For more information on the relevant error codes and messages (CCI/JDBC), please refer to the URL below:


Next, let’s take a look at the log generated by the server.


2-1.  Broker Log

In the case of the broker log, starting from the process of connecting from the application server (WAS), it contains the contents of the query, bind variables, final execution time and number, etc., so check the prior signs when analyzing the cause of performance issues and failures. You can use it for any purpose you want. Broker logs can also be disabled if the APM solution is built in the operating environment and enables real-time and post-analysis.


There are three types of logs that relate to starting the broker: access, error and SQL logs. Each log can be found in the log directory under the installation directory:

  • The access log file records information on the application client and is stored to $CUBRID/log/broker/<broker_name>.access 


  • The error log file records information on errors that occurred during the client's request processing and is stored to $CUBRID/log/broker/error_log<broker_name>_<app_server_num>.err file.


  • The SQL log file records SQL statements requested by the application client and is stored with the name of <broker_name>_<app_server_num>. sql.log. You can change the storage status, location and capacity (default: 10MB) to the parameter settings.



2-2.  Database Server Log

The database server log is divided into the log from the master, the log from each utility, and the log from the database server.

  • The master log can check information about HA and error information that occurs when connecting to servers. The location is $CUBRID/log/<hostname>_master.err.
  • The log generated by each utility stores the log generated when the utility is executed. The location is $CUBRID/log/<db name>_<utility name>.err.

*Typically, the cubrid_utility.err log is a log file that saves the log of DB startup and stop and related utilities.


  • The log generated from the database server is a log of performance issues and errors that attempt to access from a restricted IP or exceed the normal threshold. The log is located in $CUBRID/log/server, <db name>_<start date_time>.[access | event | err].

Please refer to the URL below for more information: