MySQL版本与JDBC驱动的问题
我⽤eclipse写struts的注册页⾯的时候,出现了这个问题,我上⽹查了⼀下,有⼈说这个数据库表的引擎问题,我查看了引擎发现没有问题,还有⼈说是JDBC版本的问题,我就试着去更改我的JDBC的驱动版本,还真解决了问题,我出现的错误提⽰如下:
java.sql.SQLException:Could not retrieve transation read-only status server
sql.ute(PreparedStatement.java:1278)
at com.dao.DbService.addUser(DbService.java:22)
at com.ute(RegisterAction.java:94)
flect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at flect.Method.invoke(Method.java:601)
atcom.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
atcom.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
atcom.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
atorg.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atorg.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atorg.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atorg.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atorg.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
atcom.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.ute(StrutsActionProxy.java:52)
atorg.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
atorg.apache.uteAction(ExecuteOperations.java:77)
at org.apache.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
atorg.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
atorg.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
atorg.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
atorg.StandardHostValve.invoke(StandardHostValve.java:171)
atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
atorg.StandardEngineValve.invoke(StandardEngineValve.java:118)
atorg.tor.CoyoteAdapter.service(CoyoteAdapter.java:409)
at http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at.util.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
urrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
urrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.sql.SQLException: Unknown system variable 'tx_read_only'
sql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
sql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
sql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
sql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
sql.SQL(ConnectionImpl.java:2812)
sql.SQL(ConnectionImpl.java:2761)
... 74 more
我查看了我使⽤的JDBC版本是:mysql-connector-java-5.1.26-bin.jar;然后我查看了我的数据库版本是:
然后我把我的JDBC驱动版本换成:mysql-connector-java-5.1.5-bin.jar就不会有任何问题了。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论