Cause and solution of connection is read-only problem in SSH

Source: Internet
Author: User
Tags sql error

Warn [org. hibernate. util. jdbcexceptionreporter]-<SQL error: 0, sqlstate: s1009>
Error [org. hibernate. util. jdbcexceptionreporter]-<connection is read-only. Queries leading to datamodification are not allowed>
Org. hibernate. Exception. genericjdbcexception: cocould not executeupdate Query

Cause:
If this error is reported, it is estimated that it is a problem with the transaction configuration file in SSH.

   <! -- Configure the propagation feature of transactions -->
 <TX: Advice id = "txadvice" transaction-Manager = "transactionmanager">
  <TX: Attributes>
   <TX: methodname = "add *" propagation = "required"/>
   <TX: methodname = "delete *" propagation = "required"/>
   <TX: methodname = "Modify *" propagation = "required"/>
   <TX: methodname = "*" Read-Only = "true"/>
  </TX: Attributes>
 </TX: Advice> it specifies that the database operation function must start with the above string. Otherwise, the database access permission is read-only according to the default configuration.
Generally, a database operation class xxservice inherits the basic class Dao.
The methods in database operation class xxservice are compared with those in the transaction configuration table during execution and assigned the corresponding permissions.

Solution:
There are two solutions
1. standardized naming
2. Delete read-only = "true", but this method is not recommended because it may cause unexpected problems or affect the server performance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.