Enable "General Query Log" to See the Retain Job Queries

  • 7019208
  • 20-Mar-2015
  • 07-Aug-2017

Environment


Retain 3.x
MySQL 5.x

Situation


I am seeing a MySQL error in the logs such as:  "ERROR org.hibernate.util.JDBCExceptionReporter - Data truncation: Data too long for column 'jobfname' at row 1", in my RetainServer log.
How do I see exactly what SQL command is being sent by Retain?

DISCLAIMER:

This knowledgebase (KB) article is provided for informational purposes only and as a courtesy service to you, our customer. GWAVA Technical Support does not have any database administration (DBA) expertise, nor does it provide DBA services or support. GWAVA is not responsible for the results of implementing any of the concepts contained in this KB article. Implementation of any of the concepts suggested in this KB article shall be done entirely at your own and sole risk, and GWAVA does not provide any kind of warranties whatsoever resulting from your decision of implementing any of the KB article’s concepts. It is up to you to do any research and to ensure yourself that any implementation and setup of any of the KB article’s concepts in your database system is correctly and properly executed. It is imperative that you have backups of your database system and storage directory before making any implementation. If you don’t have any DBA expertise, you should consult with a DBA expert before any implementation of the KB article’s concepts.  Under no circumstances, shall GWAVA, or any of its employees, be liable, in contract, tort, delict or otherwise, whether negligence is provable or not, for any direct, indirect, incidental, special, punitive, consequential or other damages, loss, cost or liability whatsoever that would result from or are related to the implementation of any of the concepts suggested in the KB article.


To the extent permitted by applicable law, GWAVA shall not be liable to you for any special, consequential, direct, indirect or similar damages, including any loss of data, arising out from migrating any type of messages, attachments, database, metadata in your Retain system to another server and/or location.


Resolution


Enable the MySQL "General Query log".
Disclaimer: Do this at your own risk.  GWAVA does not support problems with MySQL

To do this, run a few commands in MySQL:

SET GLOBAL log_output = 'FILE';
SET GLOBAL general_log_file = '[path to the logfile]';
SET GLOBAL general_log = 'ON';

Be sure that MySQL has rights to the path where you store the log.  Simplest way to ensure that is to send it to the MySQL data directory*.

From this point on MySQL will record the queries that Retain is sending to MySQL to the specified file.

In one particular case with the error shown in the Question section, it was seen that Retain was attempting to write to t_jobmailboxes.jobfname.  In checking the field length limits for that column, it was 45 characters wide and the job name was 53 characters; thus, producing the demonstrated error.

Once you get the logging you need, disable the general query log, or run the risk of filling up your hard drive:

SET GLOBAL general_log = 'OFF';


* Note: Default file path for MySQL is /var/lib/mysql/ for Linux. Permissions are not an issue in Windows, so put it wherever you'll remember it.

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2502.