I very recently started the process of trying to get a undocumented and poorly designed project under control. After struggling to get the thing built locally, I started running into errors when going through various functionalities.
Most of these problems appear to be a result of MySQL errors due to the way my product is generating Hibernate criteria queries. For example, when doing an autocomplete on the displayName of an object, the criteria query that results from this action is very large. I end up with around 2200 fields to select from around 50 tables. When hibernate attempts to execute this query I get an error:
30-Mar-2018 11:43:07.353 WARNING [http-nio-8080-exec-8] org.hibernate.util.JDBCExceptionReporter.logExceptions SQL Error: 1117, SQLState: HY000
30-Mar-2018 11:43:07.353 SEVERE [http-nio-8080-exec-8] org.hibernate.util.JDBCExceptionReporter.logExceptions Too many columns
[ERROR] 11:43:07 pos.services.HorriblyDefinedObjectAjax - could not execute query
org.hibernate.exception.GenericJDBCException: could not execute query
I turned on general logging for MySQL and obtained the criteria query that is trying to be executed. If I attempt to execute it in MySQLWorkbench I also get the following result:
Error Code: 1117. Too many columns
I've gone to the QA instances of this application and the autocompletes work there, which seems to indicate there is a way that this huge query will execute. Is it possible that I just do not have the right MySQL configurations on?
Currently my sql_mode='NO_ENGINE_SUBSTITUTION', is there anything else I might need to do?
Related
I am new to Workday HCM, running an integration and getting following error. Can anybody give me direction on troubleshoot this issue or any know solution to this.
An Error occurred when processing the query. The query returned too many results.. Cause: com.workday.exceptions.EndUserException: An Error occurred when processing the query. The query returned too many results.
Error - An Error occurred when processing the query
Cause - com.workday.exceptions.EndUserException
I did some more investigation and able narrow down the problem area - the problem is related to 'Business Process Transactions' data source.
I'm not sure if this is illegal, but I figured there's no harm in asking. The site is not actively maintained. I have tried contacting the website's owners and haven't had any response.
The website has an api to provide data to the public in JSON at www.website.com/api/Query. I periodically harvest data using the api (it shows the previous weeks worth of data). Recently, I received an error message while loading the site that pretty much showed the query used to load the data.
Something like this:
{"code":101,
"status":"failure",
"message":"CDbCommand failed to execute the SQL statement:
SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server /
during query. The SQL statement executed was:
SELECT * FROM table
WHERE created_date >= DATE_SUB(
(select MAX(created_date)
from table), INTERVAL 1 WEEK)"
}
CDbCommand failed to execute the SQL statement:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away./
The SQL statement executed was:
SELECT `id`
FROM `YiiSession`
WHERE id=:id
The issue resolved itself, but got me wondering if I could access historic data from the website. While I have basic understanding of how websites work in general, I have no idea how to approach this problem. Any help is appreciated.
I'm a bit stumped by this. I've used mysql 5.7x before and I've always been able to fix this issue by removing ONLY_GROUP_BY from the sql_modes in the mysql config. However, today I appear to be unable to do so, even removing it from the sql_modes setting doesn't stop me from recieving this error.
I know what causes the error and I know there is a work around that you can add to the SQL, however I do not have time to fix the litteral hundreds of queries in our application which cause this.
SQLMode setting in mysql.cnf:
sql_mode = " ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
This is then confirmed by running the query:
SELECT ##SQL_MODE;
Result:
'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
However, when running the stored proc, it still produces the error:
SQLSTATE[42000]: Syntax error or access violation: 1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'schema.emp.company_id'; this is incompatible with sql_mode=only_full_group_by
Does anyone know why mySQL appears not to recognise that the option has been disabled?
I'm running 5.7.21-0ubuntu0.17.10.1 (on Ubuntu 17.10, not surprisingly!)
Well, just to double the bizarre-ness of the entire issue, it appears that if you drop and recreate the stored proc (with no code changes, its exactly the same), the issue goes away.
This schema wasn't an existing one and mySQL upgraded over it, I did a fresh install of Ubuntu 17.10 on my machine only a few weeks ago and restored everything from backups onto it.
I'm at a loss to explain the above, I can only presume mySQL caches sql modes when it compiles(?) stored procs. I don't know if it does compile then when you create them, but it's clearly caching something.
I am executing following two queries on MySQL database using JDBC connection in JAVA.
1:
SELECT count(*)
FROM transaction
WHERE
(entry_time between STR_TO_DATE('2012-09-24 00:00:00','%Y-%m-%d %k:%i:%s')
AND STR_TO_DATE('2012-09-24 23:59:59','%Y-%m-%d %k:%i:%s'))
2:
SELECT *
FROM transaction
WHERE
(entry_time between STR_TO_DATE('2012-09-24 00:00:00','%Y-%m-%d %k:%i:%s')
AND STR_TO_DATE('2012-09-24 23:59:59','%Y-%m-%d %k:%i:%s'))
When I am searching continuously I am getting different records each time.
for e.g.
68
72
58
69
I printed the output in a log file and found that for 1st query it brings the value which is in actual in database. When the second query is executed and there is some process going on it gives different values. Why is it so?
My second question is for the second query I am getting values for '2012-09-23' also. But as per the range specified it should not bring it.
I am using MySQL 5.1 and JAVA 1.6.0_14. This is a Web Application which is now on a production server. Where I cannot debug it. :( the problem is occurring only on the production server the test setup works fine. Any help is appreciated.
For some time we have been receiving a "unknown column" error from our mysql server.
The errors look like this:
Unknown column 'JOIN search_table��z[.cc.' in 'field list'
Unknown column '(`IX_cfs$order$make$model`) INNER JOIN search_t' in 'field list'
Unknown column 'eated, cp.stat_sales, cp.stat_views, cp.culture_code' in 'field list'
+ more
The most strange part is that it's completly random which methods in our .NET code that gets the errors. Even methods that does not include any of the reported error tables in the query, sometimes reports the "unkown column" error with SQL code inside that did not belong to that query... :-(
We are running windows 2008, mysql 5.0.45 and the MySQL connector 6.2, .NET 3.5. We have an avarage 250 requests/second with peaks of 750 requests/second. MySQL CPU usage is 10-50% and Memory usage is 5-6 GB (8 GB available).
The errors started only a few months ago, but have become more and more frequent, to the point that we get +500 errors per day from ELMAH. We are suspecting that it could be something with a stressed mysql server, mix-up of connections (either in mysql, or the .NET connection pool).
We have tried to reproduce it locally and on a separate identical server setup, but so far no luck in re-generating the errors, as it does not happen for all sql queries, however a restart of the mysql service eliminates the error for a period of time. But as our userbase and server load is increasing on a 10-15% per month the error have become more an more frequent.
Any help, ideas, advice is very much appreciated...
Additional info:
We are running all external paramters (QueryString, Form post data, webservice parameters, and also internal parameters) thrue a custom function that fixes all SQL injection attempts. And we do not use "dynamic" SQL, only Stored Procedures are used.
On top of this the most frequent method that returns the "unknown column" error is a method in .NET that only takes a int32 as input parameter, an the MySQL SP also only takes a int as parameter.
Also we wrap everything in try-catch-finally, and the error we are getting is from our error handling modules (primarily ELMAH)
It looks like a corrupt query string is getting passed to mySQL.
Your .Net application is almost certainly the culprit.
SUGGESTIONS:
Look again at the code that's making the queries.
If you're lucky, you can easily isolate the actual SQL
Any any case, make sure the relevant code: where you create the query, followed by where you make the query, and finally where you access the result - is wrapped in a try/catch block.
I'm guessing that some unhandled exception might be taking you out of the flow of control path you expect to be taking, resulting in data corruption.