sql - How can I change timezone and go back previous timezone -
my project libary version mybatis 3.1 postgresql 9.2
i want change connection timezone before select query. , timezone.
first, try it. set timezone in mapper xml.
set timezone = 'asia/seoul' ; select now(); set timezone = 'utc';
i think if error occurs when select query, timezone not set utc. if timezone not set utc, query on different request utc time.
second, try it. sqlsession injected spring di.
sqlsession.selectone(namespace.settimezone, 'asia/seoul'); sqlsession.selectone(namespace.selectnow); sqlsession.selectone(namespace.settimezone, 'utc');
i think. 3 sqlsession may not same connection.
how can change timezone , go previous timezone? if process transactions, 3 sqlsession happens same connection?
use transaction.
it mybatis worth salt, support database transactions, , has use same connection statements within 1 transaction.
i don't know if mybatis can this, in postgresql can use set local
change parameter duration of transaction. reset automatically @ end of transaction.
Comments
Post a Comment