使用MySQL保存图片时出现如下错误信息:
Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '?(捥z無髪险uvI贖便?~BO惟荜H?矍=>焃脰F欶w?{Wv:溢炄平X覾\避' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2818)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2157)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2460)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2377)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2361)
at cn.com.songjy.test.db.MySQLText.save_binary_stream(MySQLText.java:144)
at cn.com.songjy.test.db.MySQLText.main(MySQLText.java:207)
原因是我的代码是UTF-8,而我的MySQL是GBK,所以出现此错误,解决方案是加上
useUnicode=true&characterEncoding=UTF-8
即
url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8
如下图:
详见:
mysql 连接url中useUnicode=true&characterEncoding=UTF-8 的作用
- 大小: 11.3 KB
分享到:
相关推荐
1、写在开头 标题之前我想说一下Linux的mysql真的实在是太坑了。太坑了。总是会出现这样那样的你想不到的问题。崩溃了。首先来罗列一下我遇到过的...Cause:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorExcepti
Cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException The last packet successfully received from the server was 47,795,922 milliseconds ago. The last packet sent successfully to the server was...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database 'hibernate' at sun.reflect.NativeConstructorAccessorImpl.new
博文链接:https://zyx19920203.iteye.com/blog/2301226
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error:GlobalConfigUtils setMetaData Fail !
可以通过异常:Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Acc
c-jdbc数据库集群中间件详细配置方案(mysql),可以同步使用多个数据库数据交换。
问题 Table ‘zup.Domain_System’ doesn’t exist ...### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zup.Domain_System' doesn't exist ; bad SQL grammar []; nested
jeecms2012sp1支持高版本mysql数据库补丁 ...com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'table_names' in information_schema 使用方法:压缩包解压,将文件拷贝到对应的目录即可
MyEclipse8.x 汉化 包括汉化语言包和汉化方法
• 并发事务,间隙锁可能互斥 (1)A删除不存在的记录,获取共享间隙锁; (2)B插入,必须获得排他间隙锁,故互斥; • 并发插入相同记录,可能死锁(某一个回滚) • 并发插入,可能出现间隙锁死锁(难排查) ...
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'idASC' in 'order clause' 错误:(desc ? "DESC" : "ASC"); 正确:(desc ? " DESC" : " ASC"); 字符串空格问题 新增 Controller...
1、Caused by: com.MySQL.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 56,201,339 milliseconds ago. The last packet sent successfully to the...
解决:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed.
可用包+源码;最新版nacos-server-1.2.0.tar.gz 支持mysql 8.0
用到GROUP BY 语句查询时com.MySQL.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘col_user_6.a.START_TIME’ ...
MySQL Connector/J is licensed under the GPL or a commercial license from MySQL AB. If you have licensed this product under the GPL, please see the COPYING ...me <mark@mysql.com> or <sales@mysql.com>.
mysql数据库版本从5.6.28升到8.0.11过程中部署项目时遇到的问题和解决方法,具体介绍如下所示: 首先这个项目用到了hibernate4.2.0,链接mysql...2.访问报错com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientCon
MySQL Connector/J @MYSQL_CJ_VERSION@ (formerly MM.MySQL) MySQL AB's JDBC Driver for MySQL Copyright (c) 2003 MySQL AB <br>CONTENTS <br>* License * Documentation Location <br> ...