java - Quartz scheduler not executing the SQL Query in a dropwizard application -
i've application created using dropwizard framework i've registered quartz-scheduler job scheduled run after every specified duration. job fires sql query sql server db , iterates resultset , sets data pojo class later pushed queue.
the sql query has union joining multiple tables fetches data records modified in delta time using last_modified_time column of related table in clause. db jar included in pom.xml sqljdbc-4.4.0 , quartz version 2.2.1
the query looks this:
select u.last_modified_date, u.account_id, u.user_id, ud.is_active user u (nolock) join user_details ud (nolock) on u.account_id = ud.account_id , u.user_id = ud.user_id u.last_modifed_date > ? , ud.last_modifed_date <= ? union select u.last_modified_date, u.account_id, u.user_id, ud.is_active user u (nolock) join user_details ud (nolock) on u.account_id = ud.account_id , u.user_id = ud.user_id join user_registration_details urd (nolock) on urd.account_id = u.account_id , urd.user_id = u.user_id , urd.reg_id = ud.reg_id urd.last_modifed_date > ? , urd.last_modifed_date <= ?
this query called simple connection statement , resultset this
final manageddatasource datasource configuration.getdatabase().build(environment.metrics(), "sql"); // configuration configuration class in drop wizard application , configuration.getdatabase() returns // datasourcefactory credentials user, password , url set try (connection conn = datasource.getconnection()) { int resultsettype = sqlserverresultset.type_ss_server_cursor_forward_only; int resultsetconcurrency = resultset.concur_read_only; logger.info("starting execution: "); try (preparedstatement pstmt = conn.preparestatement(getquery(), resultsettype,resultsetconcurrency)) { setqueryparameters(pstmt); try (resultset rs = pstmt.executequery();) { //process results } } } catch (sqlexception | ioexception ex) { logger.error(“error occurred “ + ex); } logger.info("completed execution: ");
in simple execution, prints logs "starting execution" , processes records , prints "completed execution". during execution, it's printing logs "starting execution" , "completed execution" query not fired sql db.
as didn't records modified in delta time, put profiler check if query fired , didn't found query firing db. also, i've tried adding log4jdbc library http://code.google.com/p/log4jdbc/wiki/faq print query logs no logs printed query.
with (nolock)
not mysql syntax. @ settings in wizard , see if have specified correct rdbms engine. in particular, sounds sql server syntax.
the equivalent may involve setting transaction isolation level
read uncommitted
.
wiki
Comments
Post a Comment