sql exception during reportportal login - reportportal

Below error I am getting on login :
{"errorCode":4003,"message":"You do not have enough permissions. SQL [select "public"."users"."id", "public"."users"."login", "public"."users"."password", "public"."users"."role", "public"."users"."email", "public"."project_user"."project_id", "public"."project_user"."project_role", "public"."project"."name" from "public"."users" left outer join "public"."project_user" on "public"."users"."id" = "public"."project_user"."user_id" left outer join "public"."project" on "public"."project_user"."project_id" = "public"."project"."id" where "public"."users"."login" = ?]; ERROR: relation "public.users" does not exist\n Position: 246"}
Postgres db is newly setup & I am not getting initial db script to run as reportportal db is have no tables.
Below error I am getting in reportportal api pod
... 105 common frames omitted
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: ERROR: relation "quartz.scheduler_triggers" does not exist
Position: 15
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1538)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$12.execute(JobStoreSupport.java:1527)
at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:245)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeWithoutLock(JobStoreSupport.java:3800)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1524)
at org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1505)
at org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:508)
at org.springframework.scheduling.quartz.SchedulerAccessor.addTriggerToScheduler(SchedulerAccessor.java:301)
at org.springframework.scheduling.quartz.SchedulerAccessor.registerJobsAndTriggers(SchedulerAccessor.java:245)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:505)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 115 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: relation "quartz.scheduler_triggers" does not exist
Position: 15
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2578)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2313)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:331)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:159)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:109)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:1761)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1536)
... 126 common frames omitted
postgres pod error logs :
2022-06-07 13:05:54.034 GMT [8306] ERROR: relation "public.users" does not exist at character 246
2022-06-07 13:06:12.336 GMT [8306] ERROR: relation "public.users" does not exist at character 246
2022-06-07 13:07:21.366 GMT [9106] ERROR: relation "quartz.scheduler_triggers" does not exist at character 15
2022-06-07 13:09:41.232 GMT [8306] ERROR: relation "public.users" does not exist at character 246
2022-06-07 13:12:48.544 GMT [9599] ERROR: relation "quartz.scheduler_triggers" does not exist at character 15
2022-06-07 13:16:49.031 GMT [8306] ERROR: relation "public.users" does not exist at character 246
2022-06-07 13:17:49.934 GMT [8306] ERROR: relation "public.users" does not exist at character 246
2022-06-07 13:18:23.063 GMT [10106] ERROR: relation "quartz.scheduler_triggers" does not exist at character 15
2022-06-07 13:20:11.335 GMT [8306] ERROR: relation "public.users" does not exist at character 246
2022-06-07 13:21:06.134 GMT [8306] ERROR: relation "public.users" does not exist at character 246
2022-06-07 13:23:57.972 GMT [10613] ERROR: relation "quartz.scheduler_triggers" does not exist at character 1
Any help will be appreciated.

Related

Unable to match an mysql string response in freeradius

I using freeradius 2.2.8 and mysql for sending our coa/disconnect messages via freeradius when a bandwidth quota is hit. That part of the code is working great. Unfortunately for me the coa/disconnect message is sent out even though an Accounting Stop is sent out by the NAS. In order to prevent that from happening I am putting a condition where in I pull the acct termination cause from mysql radacct table and compare it against some strings.
Under accounting,
update control {
....
Tmp-String-0 := "%{sql:SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='%{User-Name}' AND radacct.acctsessionid='%{Acct-Session-Id}'}}"
***if ("%{control:Tmp-String-0}" != "User-Request")***{
if (("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-2}") || ("%{control:Tmp-Integer-1}" > "%{control:Tmp-Integer-3}")){
if ("%{control:coa_dm}" == "coa"){
update coa {
User-Name = "%{User-Name}"
Acct-Session-Id = "%{Acct-Session-Id}"
NAS-IP-Address = "%{NAS-IP-Address}"
#Filter-Id = "UN-AUTHORIZED-PROFILE"
Framed-IP-Address = "%{Framed-IP-Address}"
Session-Timeout = 10
}
}
if ("%{control:coa_dm}" == "dm"){
update disconnect {
User-Name = "%{User-Name}"
NAS-IP-Address = "%{NAS-IP-Address}"
}
}
}
}
As per the freeradius debug logs we can see that the string should be a match and the program should avoid the inside if conditions. Unfortunately that is not the case and the 1st IF condition always returns true.
***Thu May 17 17:43:41 2018 : Info: expand: SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='%{User-Name}' AND radacct.acctsessionid='%{Acct-Session-Id}' -> SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='kiranc' AND radacct.acctsessionid='5AFD71CB-3FE1C000'
Thu May 17 17:43:41 2018 : Debug: rlm_sql (sql): Reserving sql socket id: 16
Thu May 17 17:43:41 2018 : Info: sql_xlat finished
Thu May 17 17:43:41 2018 : Debug: rlm_sql (sql): Released sql socket id: 16
Thu May 17 17:43:41 2018 : Info: expand: %{sql:SELECT acctterminatecause AS Terminate FROM radacct WHERE radacct.username='%{User-Name}' AND radacct.acctsessionid='%{Acct-Session-Id}'}} -> User-Request}
Thu May 17 17:43:41 2018 : Info: ++} # update control = noop
Thu May 17 17:43:41 2018 : Info: ++? if ("%{control:Tmp-String-0}" != "User-Request")
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-String-0} -> User-Request}
Thu May 17 17:43:41 2018 : Info: ? Evaluating ("%{control:Tmp-String-0}" != "User-Request") -> TRUE***
Thu May 17 17:43:41 2018 : Info: ++? if ("%{control:Tmp-String-0}" != "User-Request") -> TRUE
Thu May 17 17:43:41 2018 : Info: ++if ("%{control:Tmp-String-0}" != "User-Request") {
Thu May 17 17:43:41 2018 : Info: +++? if (("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-2}") || ("%{control:Tmp-Integer-1}" > "%{control:Tmp-Integer-3}"))
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-0} -> 3169
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-2} -> 25000000
Thu May 17 17:43:41 2018 : Info: ?? Evaluating ("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-2}") -> FALSE
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-1} -> 13402
Thu May 17 17:43:41 2018 : Info: expand: %{control:Tmp-Integer-3} -> 50000000
I tried the single quotes, double quotes using the & instead of %, but to no avail. The other conditions are met correctly when hit as they are returned as integers.
Thank you for the help.
I forgot to mention that I had got it working. Instead of comparing using Tmp-String-0 variable I just used the actual radius attribute name and got it working.
if (("%{Acct-Terminate-Cause}" != "User-Request")
Thank you for the help.

Mysql down because of chinese language maybe

MySQL version 5.7.19
Error:
[Fri Sep 15 14:40:25.841726 2017] [:error] [pid 17891] [client 125.39.57.36:56477] PHP Warning: mysqli_query(): (HY000/2013): Lost connection to MySQL server during query in /home/dsh.com/public_html/wp-includes/wp-db.php on line 1877
[Fri Sep 15 14:40:25.867495 2017] [:error] [pid 17891] [client 125.39.57.36:56477] WordPress database error Lost connection to MySQL server during query for query \n\t\t\t\t\tSELECT DISTINCT \n\t\t\t\t\t\ts.id,\n\t\t\t\t\t\ts.name,\n\t\t\t\t\t\ts.context,\n\t\t\t\t\t\tst.status,\n\t\t\t\t\t\ts.gettext_context, \n\t\t\t\t\t\tst.value AS tra,\n\t\t\t\t\t\ts.value AS orig\n\t\t\t\t\tFROM wep_icl_string_pages sp\n\t\t\t\t\tINNER JOIN wep_icl_string_urls su\n\t\t\t\t\t\tON su.id = sp.url_id\n\t\t\t\t\tINNER JOIN wep_icl_strings s\n\t\t\t\t\t\tON s.id = sp.string_id\n\t\t\t\t\tLEFT JOIN wep_icl_string_translations st\n\t\t\t\t\t\tON s.id=st.string_id\n\t\t\t\t\t\t\tAND st.language=su.language\n\t\t\t\t\t\t\tAND s.language!=su.language\n\t\t\t\t\tWHERE (su.language='en' and su.url='/') or (su.language='en' and su.url IS NULL)\n\t\t\t\t\t made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), WP_Locale->__construct, WP_Locale->init, __, translate, apply_filters('gettext'), WP_Hook->apply_filters, call_user_func_array, icl_sw_filters_gettext, icl_translate, WPML_Register_String_Filter->translate_by_name_and_context, WPML_ST_DB_Cache->get_translation, WPML_ST_Page_Translations_Cached_Persist->get_translations_for_page, WPML_ST_Page_Translations_Persist->get_translations_for_page
[Fri Sep 15 14:40:37.146892 2017] [:error] [pid 17884] [client 111.30.137.187:54067] WordPress database error Lost connection to MySQL server during query for query \tSELECT element_id, language_code\n\t\t\t\t\t\tFROM wep_icl_translations\n\t\t\t\t\t\tWHERE trid =\n\t\t\t\t\t\t\t(SELECT trid\n\t\t\t\t\t\t\t FROM wep_icl_translations\n\t\t\t\t\t\t\t WHERE element_type = 'post_page'\n\t\t\t\t\t\t\t AND element_id = (SELECT option_value\n\t\t\t\t\t\t\t\t\t\t\t FROM wep_options\n\t\t\t\t\t\t\t\t\t\t\t WHERE option_name='page_on_front'\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 1))\n\t\t\t\t\t\t made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, WP_Query->parse_query, get_option, apply_filters('pre_option_page_on_front'), WP_Hook->apply_filters, call_user_func_array, SitePress->pre_option_page_on_front, WPML_Pre_Option_Page->get
[Fri Sep 15 14:40:37.163339 2017] [:error] [pid 17886] [client 123.126.118.139:46358] WordPress database error Lost connection to MySQL server during query for query \tSELECT element_id, language_code\n\t\t\t\t\t\tFROM wep_icl_translations\n\t\t\t\t\t\tWHERE trid =\n\t\t\t\t\t\t\t(SELECT trid\n\t\t\t\t\t\t\t FROM wep_icl_translations\n\t\t\t\t\t\t\t WHERE element_type = 'post_page'\n\t\t\t\t\t\t\t AND element_id = (SELECT option_value\n\t\t\t\t\t\t\t\t\t\t\t FROM wep_options\n\t\t\t\t\t\t\t\t\t\t\t WHERE option_name='page_on_front'\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 1))\n\t\t\t\t\t\t made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, WP_Query->parse_query, get_option, apply_filters('pre_option_page_on_front'), WP_Hook->apply_filters, call_user_func_array, SitePress->pre_option_page_on_front, WPML_Pre_Option_Page->get
[Fri Sep 15 14:40:37.163902 2017] [:error] [pid 17885] [client 111.30.131.238:53414] WordPress database error Lost connection to MySQL server during query for query \tSELECT element_id, language_code\n\t\t\t\t\t\tFROM wep_icl_translations\n\t\t\t\t\t\tWHERE trid =\n\t\t\t\t\t\t\t(SELECT trid\n\t\t\t\t\t\t\t FROM wep_icl_translations\n\t\t\t\t\t\t\t WHERE element_type = 'post_page'\n\t\t\t\t\t\t\t AND element_id = (SELECT option_value\n\t\t\t\t\t\t\t\t\t\t\t FROM wep_options\n\t\t\t\t\t\t\t\t\t\t\t WHERE option_name='page_on_front'\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 1))\n\t\t\t\t\t\t made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, WP_Query->parse_query, get_option, apply_filters('pre_option_page_on_front'), WP_Hook->apply_filters, call_user_func_array, SitePress->pre_option_page_on_front, WPML_Pre_Option_Page->get
[Fri Sep 15 14:40:37.164819 2017] [:error] [pid 17887] [client 61.49.56.47:42110] WordPress database error Lost connection to MySQL server during query for query \tSELECT element_id, language_code\n\t\t\t\t\t\tFROM wep_icl_translations\n\t\t\t\t\t\tWHERE trid =\n\t\t\t\t\t\t\t(SELECT trid\n\t\t\t\t\t\t\t FROM wep_icl_translations\n\t\t\t\t\t\t\t WHERE element_type = 'post_page'\n\t\t\t\t\t\t\t AND element_id = (SELECT option_value\n\t\t\t\t\t\t\t\t\t\t\t FROM wep_options\n\t\t\t\t\t\t\t\t\t\t\t WHERE option_name='page_on_front'\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 1))\n\t\t\t\t\t\t made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, WP_Query->parse_query, get_option, apply_filters('pre_option_page_on_front'), WP_Hook->apply_filters, call_user_func_array, SitePress->pre_option_page_on_front, WPML_Pre_Option_Page->get
[Fri Sep 15 14:40:37.248191 2017] [:error] [pid 17907] [client 111.30.141.105:34515] PHP Warning: mysqli_query(): (HY000/2013): Lost connection to MySQL server during query in /home/dsh.com/public_html/wp-includes/wp-db.php on line 1877
[Fri Sep 15 14:40:37.546416 2017] [:error] [pid 17940] [client 111.30.141.104:46769] WordPress database error Lost connection to MySQL server during query for query \n\t\t\t\t\tSELECT DISTINCT \n\t\t\t\t\t\ts.id,\n\t\t\t\t\t\ts.name,\n\t\t\t\t\t\ts.context,\n\t\t\t\t\t\tst.status,\n\t\t\t\t\t\ts.gettext_context, \n\t\t\t\t\t\tst.value AS tra,\n\t\t\t\t\t\ts.value AS orig\n\t\t\t\t\tFROM wep_icl_string_pages sp\n\t\t\t\t\tINNER JOIN wep_icl_string_urls su\n\t\t\t\t\t\tON su.id = sp.url_id\n\t\t\t\t\tINNER JOIN wep_icl_strings s\n\t\t\t\t\t\tON s.id = sp.string_id\n\t\t\t\t\tLEFT JOIN wep_icl_string_translations st\n\t\t\t\t\t\tON s.id=st.string_id\n\t\t\t\t\t\t\tAND st.language=su.language\n\t\t\t\t\t\t\tAND s.language!=su.language\n\t\t\t\t\tWHERE (su.language='en' and su.url='/') or (su.language='en' and su.url IS NULL)\n\t\t\t\t\t made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), WP_Locale->__construct, WP_Locale->init, __, translate, apply_filters('gettext'), WP_Hook->apply_filters, call_user_func_array, icl_sw_filters_gettext, icl_translate, WPML_Register_String_Filter->translate_by_name_and_context, WPML_ST_DB_Cache->get_translation, WPML_ST_Page_Translations_Cached_Persist->get_translations_for_page, WPML_ST_Page_Translations_Persist->get_translations_for_page
[Fri Sep 15 14:40:37.548473 2017] [:error] [pid 17941] [client 112.65.193.15:41552] WordPress\xe6\x95\xb0\xe6\x8d\xae\xe5\xba\x93\xe6\x9f\xa5\xe8\xaf\xa2\n\t\t\t\t\tSELECT DISTINCT \n\t\t\t\t\t\ts.id,\n\t\t\t\t\t\ts.name,\n\t\t\t\t\t\ts.context,\n\t\t\t\t\t\tst.status,\n\t\t\t\t\t\ts.gettext_context, \n\t\t\t\t\t\tst.value AS tra,\n\t\t\t\t\t\ts.value AS orig\n\t\t\t\t\tFROM wep_icl_string_pages sp\n\t\t\t\t\tINNER JOIN wep_icl_string_urls su\n\t\t\t\t\t\tON su.id = sp.url_id\n\t\t\t\t\tINNER JOIN wep_icl_strings s\n\t\t\t\t\t\tON s.id = sp.string_id\n\t\t\t\t\tLEFT JOIN wep_icl_string_translations st\n\t\t\t\t\t\tON s.id=st.string_id\n\t\t\t\t\t\t\tAND st.language=su.language\n\t\t\t\t\t\t\tAND s.language!=su.language\n\t\t\t\t\tWHERE (su.language='zh-hans' and su.url='/zh-hans/custom_events/equis%e9%85%92%e5%90%a7%e9%9a%86%e9%87%8d%e5%bc%80%e5%b9%95') or (su.language='zh-hans' and su.url IS NULL)\n\t\t\t\t\t\xe6\x97\xb6\xe5\x8f\x91\xe7\x94\x9fLost connection to MySQL server during query\xe9\x94\x99\xe8\xaf\xaf\xef\xbc\x8c\xe8\xbf\x99\xe6\x98\xaf\xe7\x94\xb1require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), WP_Locale->__construct, WP_Locale->init, __, translate, apply_filters('gettext'), WP_Hook->apply_filters, call_user_func_array, icl_sw_filters_gettext, icl_translate, WPML_Register_String_Filter->translate_by_name_and_context, WPML_ST_DB_Cache->get_translation, WPML_ST_Page_Translations_Cached_Persist->get_translations_for_page, WPML_ST_Page_Translations_Persist->get_translations_for_page\xe6\x9f\xa5\xe8\xaf\xa2\xe7\x9a\x84\xe3\x80\x82, referer: https://m.sogou.com/web/searchList.jsp?uID=HGHnQBYb1jn6MZnw&v=5&dp=1&e=1427&de=1&pid=sogou-clse-2996962656838a97&w=1278&t=1505457569445&s_t=1505457585463&s_from=result_up&htprequery=equis%E9%85%92%E5%90%A7&keyword=equis%E9%85%92%E5%90%A7&pg=webSearchList&sugct=0&sugri=1&sourceid=sugg&sugoq=equis&sugn=5&suguuid=f4fd7139-d195-45f4-ba59-125c7078ccc8&sugsuv=c7f6d6271727f247197063a73eebad69&sugtime=1505457585502
[Fri Sep 15 14:40:37.699627 2017] [:error] [pid 17907] [client 111.30.141.105:34515] WordPress database error Lost connection to MySQL server during query for query \n\t\t\t\t\tSELECT DISTINCT \n\t\t\t\t\t\ts.id,\n\t\t\t\t\t\ts.name,\n\t\t\t\t\t\ts.context,\n\t\t\t\t\t\tst.status,\n\t\t\t\t\t\ts.gettext_context, \n\t\t\t\t\t\tst.value AS tra,\n\t\t\t\t\t\ts.value AS orig\n\t\t\t\t\tFROM wep_icl_string_pages sp\n\t\t\t\t\tINNER JOIN wep_icl_string_urls su\n\t\t\t\t\t\tON su.id = sp.url_id\n\t\t\t\t\tINNER JOIN wep_icl_strings s\n\t\t\t\t\t\tON s.id = sp.string_id\n\t\t\t\t\tLEFT JOIN wep_icl_string_translations st\n\t\t\t\t\t\tON s.id=st.string_id\n\t\t\t\t\t\t\tAND st.language=su.language\n\t\t\t\t\t\t\tAND s.language!=su.language\n\t\t\t\t\tWHERE (su.language='en' and su.url='/') or (su.language='en' and su.url IS NULL)\n\t\t\t\t\t made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), WP_Locale->__construct, WP_Locale->init, __, translate, apply_filters('gettext'), WP_Hook->apply_filters, call_user_func_array, icl_sw_filters_gettext, icl_translate, WPML_Register_String_Filter->translate_by_name_and_context, WPML_ST_DB_Cache->get_translation, WPML_ST_Page_Translations_Cached_Persist->get_translations_for_page, WPML_ST_Page_Translations_Persist->get_translations_for_page
whenever mysql is down this kind of error generates in apache error_log.
can anyone please give advise what is wrong ?

Error in executing dynamic SQL Query with table variable in SQL Server 2008

These are the following parameters & table variable used for executing dynamic sql query:
Declaration
DECLARE #sQuery VARCHAR(MAX)
DECLARE #FYear NVARCHAR(10)='2016-2017'
DECLARE #TYear NVARCHAR(10)='2016-2018'
DECLARE #CLAIMSUM TABLE
(
ClaimType NVARCHAR(MAX),
JAN DECIMAL(19,6),
FEB DECIMAL(19,6),
MAR DECIMAL(19,6),
APR DECIMAL(19,6),
MAY DECIMAL(19,6),
JUN DECIMAL(19,6),
JUL DECIMAL(19,6),
AUG DECIMAL(19,6),
SEP DECIMAL(19,6),
OCT DECIMAL(19,6),
NOV DECIMAL(19,6),
DEC DECIMAL(19,6),
TOTAL DECIMAL(19,6)
)
Dynamic SQL Query
SET #sQuery=N'SELECT C1.ClaimType,
SUM(C1.JAN) AS ''JAN '+#FYear+'-'+#TYear+''',SUM(C1.FEB) AS ''FEB '+#FYear+'-'+#TYear+''',SUM(C1.MAR) AS ''MAR '+#FYear+'-'+#TYear+''',
SUM(C1.APR) AS ''APR '+#FYear+'-'+#TYear+''',SUM(C1.MAY) AS ''MAY '+#FYear+'-'+#TYear+''',SUM(C1.JUN) AS ''JUN '+#FYear+'-'+#TYear+''',
SUM(C1.JUL) AS ''JUL '+#FYear+'-'+#TYear+''',SUM(C1.AUG) AS ''AUG '+#FYear+'-'+#TYear+''',SUM(C1.SEP) AS ''SEP '+#FYear+'-'+#TYear+''',
SUM(C1.OCT) AS ''OCT '+#FYear+'-'+#TYear+''',SUM(C1.NOV) AS ''NOV '+#FYear+'-'+#TYear+''',SUM(C1.DEC) AS ''DEC '+#FYear+'-'+#TYear+''',
SUM(C1.TOTAL) AS ''TOTAL''
FROM #CLAIMSUM C1 GROUP BY C1.ClaimType';
EXECUTE #sQuery
Error
When executing this query I am getting following error:
The name 'SELECT C1.ClaimType,
SUM(C1.JAN) AS 'JAN 2016-2017',SUM(C1.FEB) AS 'FEB 2016-2017',SUM(C1.MAR) AS 'MAR 2016-2017',
SUM(C1.APR) AS 'APR 2016-2017',SUM(C1.MAY) AS 'MAY 2016-2017',SUM(C1.JUN) AS 'JUN 2016-2017',
SUM(C1.JUL) AS 'JUL 2016-2017',SUM(C1.AUG) AS 'AUG 2016-2017',SUM(C1.SEP) AS 'SEP 2016-2017',
SUM(C1.OCT) AS 'OCT 2016-2017',SUM(C1.NOV) AS 'NOV 2016-2017',SUM(C1.DEC) AS 'DEC 2016-2017',
SUM(C1.TOTAL) AS 'TOTAL'
FROM #CLAIMSUM C1 GROUP BY C1.ClaimType' is not a valid identifier.
I had replaced EXECUTE #sQuery with EXECUTE (#sQuery) and now it is working fine.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'fototekn_digi.ln_filter' doesn't exist

Why I am getting the following MySQL error?
SQLSTATE[42S02 Base table or view not found: 1146 Table 'fototekn_digi.ln_filter' doesn't exist, query was: SELECT COUNT(*) FROM `ln_filter` AS `main_table` WHERE (attribute_code = 'price')";
0 /chroot/home/fototekn/fototeknoloji.com/html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
1 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
2 /chroot/home/fototekn/fototeknoloji.com/html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
3 /chroot/home/fototekn/fototeknoloji.com/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT COUNT(*)...', Array)
4 /chroot/home/fototekn/fototeknoloji.com/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(*)...', Array)
5 /chroot/home/fototekn/fototeknoloji.com/html/lib/Zend/Db/Adapter/Abstract.php(828): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
6 /chroot/home/fototekn/fototeknoloji.com/html/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract->fetchOne(Object(Varien_Db_Select), Array)
7 /chroot/home/fototekn/fototeknoloji.com/html/app/code/local/EM/LayeredNavigation/Block/Adminhtml/Filter/Grid.php(20): Varien_Data_Collection_Db->getSize()
8 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(626): EM_LayeredNavigation_Block_Adminhtml_Filter_Grid->_prepareCollection()
9 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid()
10 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(929): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml()
11 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(648): Mage_Core_Block_Abstract->toHtml()
12 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(592): Mage_Core_Block_Abstract->_getChildHtml('grid', true)
13 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php(77): Mage_Core_Block_Abstract->getChildHtml('grid')
14 /chroot/home/fototekn/fototeknoloji.com/html/app/design/adminhtml/default/default/template/widget/grid/container.phtml(36): Mage_Adminhtml_Block_Widget_Grid_Container->getGridHtml()
15 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Template.php(241): include('/chroot/home/fo...')
16 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
17 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
18 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
19 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(308): Mage_Adminhtml_Block_Template->_toHtml()
20 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(930): Mage_Adminhtml_Block_Widget_Container->_toHtml()
21 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
22 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(930): Mage_Core_Block_Text_List->_toHtml()
23 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(648): Mage_Core_Block_Abstract->toHtml()
24 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(592): Mage_Core_Block_Abstract->_getChildHtml('content', true)
25 /chroot/home/fototekn/fototeknoloji.com/html/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content')
26 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Template.php(241): include('/chroot/home/fo...')
27 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
28 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
29 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
30 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Block/Abstract.php(930): Mage_Adminhtml_Block_Template->_toHtml()
31 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
32 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
33 /chroot/home/fototekn/fototeknoloji.com/html/app/code/local/EM/LayeredNavigation/controllers/Adminhtml/FilterController.php(12): Mage_Core_Controller_Varien_Action->renderLayout()
34 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): EM_LayeredNavigation_Adminhtml_FilterController->indexAction()
35 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
36 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
37 /chroot/home/fototekn/fototeknoloji.com/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
38 /chroot/home/fototekn/fototeknoloji.com/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
39 /chroot/home/fototekn/fototeknoloji.com/html/index.php(80): Mage::run('', 'store')
40 {main}";s:3:"url";s:80:"/index.php/layernav/adminhtml_filter/index/key/1f03428d4c76b6a6754acb3d90df4119/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
As the error message says, you're getting the error because the table fototekn_digi.ln_filter does not exist.
The original query that caused that error was:
SELECT COUNT(*) FROM `ln_filter` AS `main_table` WHERE (attribute_code = 'price')";
It would seem that somehow the ln_filter table is resolving to a full name of fototekn_digi.ln_filter, and that no table exists by that fully qualified name.
If you would like more help with this issue, I would suggest providing some or all of the following:
What steps have you tried to resolve the error or deduce its origin?
How is this error being produced? What code is causing the error?
Do you expect a table named ln_filter to exist?

logging mysql statements executed by jdbc

I tried to log mysql statements , executed by jdbc , hoping to see strings containing declare some cursor or fetch some cursor. But there was not.
Are there any ways to see them?
PS i set variables in mysql as following:
SET GLOBAL log_output="FILE"
SET GLOBAL general_log_file="Path/File"
SET GLOBAL general_log='ON'
Try this.
Add 'logger' and 'profileSQL' to the jdbc url:
&logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true
Then you will get the SQL statement below:
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 999 resultset: 0
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 999 resultset: 0 message: SET sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 999 resultset: 0
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 2 connection: 19130945 statement: 13 resultset: 17 message: select 1
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 0 connection: 19130945 statement: 13 resultset: 17
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 15 resultset: 18 message: select ##session.tx_read_only
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 0 connection: 19130945 statement: 15 resultset: 18
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 2 connection: 19130945 statement: 14 resultset: 0 message: update sequence set seq=seq+incr where name='demo' and seq=4602
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 0 connection: 19130945 statement: 14 resultset: 0
The default logger is:
com.mysql.jdbc.log.StandardLogger
Mysql jdbc property list: https://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html