Caused by: java.sql.SQLException: Connection is read-only. Queries leading to da


错误信息:
Caused by: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed   有人遇到过这个问题吗?  可以查询 添加 删除 但是修改的时候 就报这个错误,别人机子上就可以正常修改  急求!!!????(已排除配置文件设置只读和数据库用户没有权限)


Caused by: java.sql.SQLException: Connection is read-only. Queries leading to da

解决办法:
1. 查看spring配置是否设置只读
<bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
       <property name="transactionManager" ref="transactionManager"/>
       <property name="transactionAttributes">
           <props>
              <prop key="*">readOnly</prop>
              <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop>
              <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop>
              <prop key="modify*">PROPAGATION_REQUIRED,-Exception</prop>
              <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop>
              <prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop>
              <prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop>
              <prop key="query*">PROPAGATION_REQUIRED, readOnly,-Exception</prop>
              <prop key="load*">PROPAGATION_REQUIRED, -Exception</prop>
           </props>
       </property>
    </bean>

2. spring事务是否设置只读:解决方法:把 <tx:method name="*" read-only="true"/>干掉
3. 数据库是否拥有权限
4.强制修改是否可读写:
//如果有事务,那么加入事务,没有的话新建一个(不写的情况下),readOnly=true只读,不能更新,删除(默认为false)
@Transactional (propagation = Propagation.REQUIRED,readOnly=false)

你可能感兴趣的:(SQLException)