{"id":487,"date":"2017-11-28T16:04:00","date_gmt":"2017-11-28T08:04:00","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=487"},"modified":"2017-11-28T16:04:00","modified_gmt":"2017-11-28T08:04:00","slug":"mysql%e9%94%99%e8%af%af-could-not-retrieve-transation-read-only-status-server","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=487","title":{"rendered":"MySQL\u9519\u8bef: could not retrieve transation read-only status server"},"content":{"rendered":"<div><b>\u95ee\u9898\u63cf\u8ff0\uff1a<\/b>\u00a0java\u4ee3\u7801\u5728\u5f00\u59cb\u4e8b\u52a1\u540e\uff0c\u5148\u505a\u4e86\u4e00\u4e2a\u67e5\u8be2\uff0c\u518dinsert\uff0c\u6b64\u65f6\u4f1a\u62a5\uff1a<\/div>\n<div>\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0java.sql.SQLException: could not retrieve transation read-only status server<\/div>\n<div><\/div>\n<div>\n<p><b>\u89e3\u51b3\u8fc7\u7a0b\uff1a<\/b><\/p>\n<p>\u67e5\u770bmysql\u7684\u4e8b\u7269\u9694\u79bb\u7ea7\u522b SHOW\u00a0VARIABLES LIKE &#8216;%iso%&#8217;;<\/p>\n<p>\u8fd4\u56de\u7ed3\u679c\uff1a\u00a0REPEATABLE-READ<\/p>\n<p>\u628a\u8fd9\u4e2a\u6539\u6210\uff1aREAD-COMMITTED \u5c31\u597d\u4e86\uff1a SET GLOBAL tx_isolation=&#8217;READ-COMMITTED&#8217;;<\/p>\n<p>\uff08\u8bb0\u5f97java\u91cd\u542f\u5e94\u7528\uff0c\u8981\u6c38\u4e45\u751f\u6548\u7684\u5c31\u6539my.ini\u914d\u7f6e\u6587\u4ef6\uff09<\/p>\n<p><b>\u95ee\u9898\u5206\u6790\uff1a<\/b><\/p>\n<p>\u5f53\u6570\u636e\u5e93\u9694\u79bb\u7ea7\u522b\u4e3aREPEATABLE-READ\u65f6\uff0c\u67e5\u8be2\u4e00\u4e2aselect\u8bed\u53e5\u4e5f\u7b97\u662f\u4e8b\u7269\u7684\u5f00\u59cb\uff0c\u800c\u4e14\u5728hibernate\u91cc\u4f1a\u628a\u4ee5select\u8bed\u53e5\u5f00\u5934\u7684\u4e8b\u52a1\u6807\u8bb0\u4e3a\u53ea\u8bfb\u4e8b\u52a1\uff0c\u6b64\u65f6\u5728\u8fd9\u4e2a\u4e8b\u52a1\u91cc\u518d\u6267\u884cinsert\u3001update\u3001delete\u7b49DML\u8bed\u53e5\u5c31\u4f1a\u62a5\u9519\u3002<\/p>\n<p><a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/server-system-variables.html#sysvar_tx_read_only\" rel=\"nofollow\">http:\/\/dev.mysql.com\/doc\/refman\/5.6\/en\/server-system-variables.html#sysvar_tx_read_only<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\u63cf\u8ff0\uff1a\u00a0java\u4ee3\u7801\u5728\u5f00\u59cb\u4e8b\u52a1\u540e\uff0c\u5148\u505a\u4e86\u4e00\u4e2a\u67e5\u8be2\uff0c\u518dinsert\uff0c\u6b64\u65f6\u4f1a\u62a5\uff1a \u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0java.sql.SQLException: could not retrieve transation read-only status server \u89e3\u51b3\u8fc7\u7a0b\uff1a \u67e5\u770bmysql\u7684\u4e8b\u7269\u9694\u79bb\u7ea7\u522b SHOW\u00a0VARIABLES LIKE &#8216;%iso%&#8217;; \u8fd4\u56de\u7ed3\u679c\uff1a\u00a0REPEATABLE-READ \u628a\u8fd9\u4e2a\u6539\u6210\uff1aREAD-COMMITTED \u5c31\u597d\u4e86\uff1a SET [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-487","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=487"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/487\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}