add mysql transaction, return json output.

add mysql transaction, return json output.