• The MySQL server is running with the --read-only option so it cannot execute this statement


    1、错误描述

    Caused by: java.sql.SQLException: The MySQL server is running with the --read-only option so it cannot execute this statement
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
    	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1199)
    	
    	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:56)
    	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)
    
    	at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59)
    	at com.sun.proxy.$Proxy36.query(Unknown Source)
    	at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:54)
    	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)
    	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)
    	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)
    	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
    	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
    	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)
    	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62)
    	at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	at core.util.CustomSqlSessionTemplate$SqlSessionInterceptor.invoke(CustomSqlSessionTemplate.java:305)
    	... 81 more
    

    2、错误原因

         数据库表设置成只读,但是在修改更新操作时用到这张表,导致报错


    3、解决办法

    (1)将只读属性改为可写可读

    (2)新建一张可读的数据库表

  • 相关阅读:
    Java第十三天,内部类
    Java第十二天,权限修饰符
    Java面向对象基础
    opencv配置(win10+VS2015+opencv3.1)
    malloc函数
    C++用new创建对象和不用new创建对象的区别解析
    字符串匹配KMP算法中Next[]数组和Nextval[]数组求法
    C++将一个数组内容赋给另一个数组
    C++中的const和指针组合
    通过图片对比带给你不一样的KMP算法体验
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13314106.html
Copyright © 2020-2023  润新知