java串連MySQL進行增刪改操作時報錯

來源:互聯網
上載者:User

標籤:

java串連MySQL資料庫後執行execute語句,控制台總是報錯,如下:

  Exception in thread "main" java.sql.SQLException: Could not retrieve transation read-only status server

  ……?

  Caused by: java.sql.SQLException: Unknown system variable ‘tx_read_only‘

我搗鼓了一整個下午,參考別人的代碼,甚至完全套用別人的工程來跑一遍結果還是報這個錯誤。

排除語法錯誤後我以為是connector有問題,但重新下了一個仍無濟於事,

最後我索性把MySQL卸掉,到官網重下了個最新版,以及最新版connector,結果大功告成。

所以結論是:connector和MySQLserver的版本不匹配或者其中某一個有問題?

java串連MySQL進行增刪改操作時報錯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.