首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将数据保存到mysql工作台时出错。

问将数据保存到mysql工作台时出错。
EN

Stack Overflow用户
提问于 2020-12-03 14:55:46
回答 2查看 78关注 0票数 1

这是我的MYSQL数据库:在这里输入图像描述

在这里输入图像描述

这是代码在这里输入图像描述

在这里输入图像描述

和错误信息:运行: thg 12 03,2020年9:45:51 CH program.StudentModify插入严厉: null program.StudentModify,您的SQL语法中有错误;检查与您的MySQL服务器版本对应的手册,以获得使用“Number”值的正确语法(“sdsdsd”、“男性”、23、“sdsdsd”,(‘232323’)在java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native方法第1行)在java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62),在java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45),在java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500),在java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481),在com.mysql.jdbc.Util。com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL( com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1915) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1254) at program.StudentModify.insert(StudentModify.java:79) at program.StudentJFrame.btSaveActionPerformed(StudentJFrame.java:260) at program.StudentJFrame$3.actionPerformed(StudentJFrame.java:111) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java ).desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6636) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342) at java.desktop/java.awt.Component.processEvent(Component.java:6401) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5012) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4919) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4548)java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307),java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2764),java.desktop/java.awt.Component.dispatchEvent(Component.java:4844),java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772),java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721),java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)在java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at java。base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.桌面/java.awt。EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-12-03 15:01:49

也许你应该把“电话号码”写在一个词里,比如PhoneNumber。

或者在insert语句中的单词周围用倒带写Phone Number --在create语句中,您在字段名周围使用backticks。

代码语言:javascript
复制
You have an error in your SQL syntax; check the manual that corresponds to 
your MySQL server version for the right syntax to use near 'Number) 
values('sdsdsd','Male',23,'sdsdsd','232323')' 

“Number”可能是“电话号码”的第二部分。

票数 0
EN

Stack Overflow用户

发布于 2020-12-03 15:13:18

也许你可以尝试而不是:

字符串url = "jdbc:mysql://localhost:3306/studentmanagement?&useSSL=false“

尝试:

字符串url = "jdbc:mysql://localhost:3306/studentmanagement?autoReconnet=true&useSSL=false“

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65128381

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档