java储存mysql乱码报错

我现在是都文本来储存数据库, 做的是记录搜索内容的东西, 可是如果搜索内容本身中就有乱码, 要如何解决
图片说明
比如这个图片,那个像L的东西, String line = new String(br.readLine().getBytes(), "ISO8859_1" ) 转utf-8 也没用

报这样的错
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\x8C\xE8\xBF...' for column 'keyWord' at row 52

3个回答

强制转 成utf8。mysql 中set names utf8; 然后导数据库,后面的访问就没有问题了

查看下数据库编码、字段编码和你写入是的编码是不是一致!

这个应该是那些特殊表情的搜索了吧,mysql只有5.5之上才能用utf8mb4字符集,如果你的mysql是5.5以上的就可以将数据库改成utf8mb4字符集,否则就要子转换比较,会很麻烦

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
java导入mysql出现中文乱码
我写了一个小程序把txt中的文字读取并写入mysql,然而无论怎么样都有乱码,我试了很多方法都不行,结果最后解决居然是因为url的问题,崩溃了,求大神们看看 之前是这样 ``` public static final String url = "jdbc:mysql://127.0.0.1/website?useUnicode=true&characterEncoding=UTF-8"; ``` 改成这样竟然就没问题了。。。 ``` public static final String url = "jdbc:mysql://localhost/website?characterEncoding=utf8"; ``` 为什么。。。。。。
java读取mysql乱码问题
1.mysql数据库、表、字段都已设置utf8 ![图片说明](https://img-ask.csdn.net/upload/201812/15/1544856224_369026.png) 2.java环境、编码都设置utf8,jsp编码都设置utf8 3.Tomcat已设置utf8 4.mysql命令行写入添加中文字段数据不报错,查询都是? 直接读数据库的数据如下: [Category [cid=1, cname=手机数码], Category [cid=172934bd636d485c98fd2d3d9cccd409, cname=运动户外], Category [cid=2, cname=电脑办公], Category [cid=3, cname=家具家居], Category [cid=4, cname=鞋靴箱包], Category [cid=5, cname=图书音像], Category [cid=6, cname=母婴孕婴], Category [cid=afdba41a139b4320a74904485bdb7719, cname=汽车用品]] 弄得头都大了,实在不知道哪里还能有错le
求教JAVA应用传入mysql中文乱码
JAVA的应用程序用JDBC连接mysql 类似汉字的查询都成功不了,插入汉字也是???乱码 从数据库返回的汉字正常。 数据库和MyEclipse都是GBK编码 ?useUnicode=true&characterEncoding=UTF-8 这个试过了 没用 查询代码如下 java.sql.Statement stmt = connection.createStatement(); String string="哦"; ResultSet rs = stmt.executeQuery("select * from fix where q='"+string+"'"); while (rs.next()) { System.out.println(rs.getString(3) + "\t" + rs.getString(4)); } 求解怎么传入汉字
java 连接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 '?,?,?)' at line ![ 图片说明](https://img-ask.csdn.net/upload/201707/31/1501502405_276345.png) mysql和 idea 编码都设置为了utf-8怎么不行啊
java中mysql的异常 ,求助
异常如下: 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 'sum(money,time,nature)value(50000.0,'2019-11-08 15:15:46','购买车位')' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) 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(ConnectionImpl.java:2465) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2133) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2067) at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5175) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2052) at shujuku.insert_money.<init>(insert_money.java:26) at car_people.pe_add$1.actionPerformed(pe_add.java:182) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 源代码: package shujuku; import java.sql.*; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class insert_money { String sq5 = "insert into sum(money,time,nature)"+"value(?,?,?)"; Calendar calendar = Calendar.getInstance(); long int_time_js = calendar.getTimeInMillis(); Date aaaaa = calendar.getTime(); SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String in_time, xingzi; double mm; public insert_money(double money,String sss) { Connection conn = new shujuku().getConnection(); mm = money; xingzi = sss; in_time = sdf3.format(aaaaa); try { PreparedStatement ps = conn.prepareStatement(sq5); ps.setDouble(1,mm); ps.setString(2,in_time); ps.setString(3,xingzi); ps.executeUpdate(); ps.close(); }catch (Exception e1) { e1.printStackTrace(); }finally{ // 关闭数据库连接 shujuku.closeConnection(conn); } } }
java +mysql LOAD DATA INFILE mysql中执行正常,java报错???
LOAD DATA INFILE '/txt/test.txt' INTO TABLE test LINES TERMINATED BY '\r\n' java.sql.SQLException: Could not retrieve transation read-only status server at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:877) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:873) at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3603) at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3572) at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:759) at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:739) at LoadDateFile.main(LoadDateFile.java:45) Caused by: java.sql.SQLException: Unknown system variable 'tx_read_only' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369) at com.mysql.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:3597) ... 4 more public static void main(String[] args) { try { //System.out.println("start;"); Class.forName("com.mysql.jdbc.Driver"); //System.out.println("com.mysql;"); conn = DriverManager.getConnection(url,user,password); System.out.println("conn:"); stmt = conn.createStatement(); // System.out.println("load date infile"); String sql = "LOAD DATA INFILE '/txt/test.txt' INTO TABLE test LINES TERMINATED BY '\\r\\n' "; //sql="SELECT * FROM test"; // sql = "load data infile 'E:/mysqlsql/test.txt' replace into table test character set GBK fields terminated by ',' enclosed by '\'' lines terminated by '\r\n'"; System.out.println(sql); boolean result = stmt.execute(sql); System.out.println("Load执行结果:" + result); }catch(Exception e){ e.printStackTrace(); } }
JAVA向MySQL插入语句报错
String sql = "insert into staffs(username, pass, tel, age) values ('"+ username + "’, ’" + pass + "’, ’" + tel + "’, ’" + age + "’)"; 其中username,pass,tel,age都是变量 报出的错误: 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 ''1’, ’1’, ’1’, ’1’)' at line 1
Eclipse用JAVA连接Mysql 插入大量数据报错 Java heap space
public void Get_WayId_Ref_isWay() throws IOException { PreparedStatement ps = null; Connection con=null; BufferedReader br=new BufferedReader(new FileReader(Path.path_read_beijing)); StringBuffer s=null; StringBuffer wayId=null; StringBuffer isWay=new StringBuffer("false"); String regex_nd="\\d+"; //用匹配<way id后面的数字 String regex_id="(?<=id=\")\\d+"; //读取整个文件信息 try { Class.forName(driver).newInstance(); con=DriverManager.getConnection(url,user,pwd); con.setAutoCommit(false); int count=0; int batchCount=1; while((s=new StringBuffer(br.readLine()))!=null) { count++; ArrayList<StringBuffer> tmp=new ArrayList<StringBuffer>(); //找出way类的信息 if(batchCount%100==0) { ps.clearBatch(); } if(s.indexOf("<way")>0) { //获得每一组WayId Pattern p1=Pattern.compile(regex_id); Matcher m1=p1.matcher(s); if(m1.find()) { wayId=new StringBuffer(m1.group()); } while (s.indexOf("</way>") <= 0) { count++; s=new StringBuffer(br.readLine()); //获得该wayid下的refid if(s.indexOf("<nd")>0) { System.out.println("所在行数:"+count); Pattern p=Pattern.compile(regex_nd); Matcher m=p.matcher(s); if(m.find()) { tmp.add(new StringBuffer(m.group())); } } //判断该way是否为道路 if(s.indexOf("<tag k=\"highway\"")>0||s.indexOf("<tag k=\"cycleway\"")>0||s.indexOf("<tag k=\"bridge\"")>0) { isWay=new StringBuffer("true"); } } for(int i=0;i<tmp.size();i++) { if(isWay.toString().equals("true")) { batchCount++; StringBuffer sql1 = new StringBuffer(); sql1.append("insert into test_wayid(wayid,id,isway) values("); sql1.append("'" +wayId+"'"); sql1.append(", '"+tmp.get(i)+"', '"+"1');"); ps=con.prepareStatement(sql1.toString()); ps.addBatch(); } if(isWay.toString().equals("false")) { batchCount++; StringBuffer sql1 = new StringBuffer(); sql1.append("insert into test_wayid(wayid,id,isway) values("); sql1.append("'" +wayId+"'"); sql1.append(", '"+tmp.get(i)+"', '"+"1');"); ps=con.prepareStatement(sql1.toString()); ps.addBatch(); } ps.executeBatch(); if(batchCount%100==0) { con.commit(); } } } } con.commit(); } catch (Exception e) { e.printStackTrace(); // TODO: handle exception }finally{ try { if(ps!=null) ps.close(); if(con!=null) con.close(); } catch (Exception e2) { e2.printStackTrace(); } } } 报的错误是: java.sql.SQLException: java.lang.OutOfMemoryError: Java heap space at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.Util.handleNewInstance(Util.java:430) at com.mysql.jdbc.PreparedStatement.getInstance(PreparedStatement.java:561) at com.mysql.jdbc.ConnectionImpl.clientPrepareStatement(ConnectionImpl.java:1395) at com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4178) at com.mysql.jdbc.ConnectionImpl.prepareStatement(ConnectionImpl.java:4077) at Wayid_To_Sql.Get_Map_Line_beta.Get_WayId_Ref_isWay(Get_Map_Line_beta.java:128) at Wayid_To_Sql.Get_Map_Line_beta.main(Get_Map_Line_beta.java:35)
MYSQL导入报错,指点下
同一个PMA,连接MYSQL导出,然后再导入到另一个MYSQL就报错了 直接导入报“连接已重置” 用SQL执行也是“连接已重置”
C++ 操作mysql 中文乱码问题
VS2017 用的 connector/c++ 连接mysql数据库 向mysql数据库中存储数据时,中文会乱码,mysql报错,求助各位大佬
navicat for mysql 连接报错1251详细解决步骤
![图片说明](https://img-ask.csdn.net/upload/201804/27/1524833469_955718.jpg) navicat for mysql 连接报错1251详细解决步骤
java连接MYSQL数据库第一次可以,第二次报错
做项目在做一个用户首次登陆输入手机号码,发送随机密码的功能模块,首次点击完全没问题,系统会发送短信(中国移动的短信机的原理是连接它的数据库,插入一条数据即可)问题就出在连接数据库的问题上,再次发送,则后台报错ResultSet is from UPDATE. No Data.。 报错信息如下 ``` 严重: Exception occurred during processing request: ResultSet is from UPDATE. No Data. java.sql.SQLException: ResultSet is from UPDATE. No Data. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7152) at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3867) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3404) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2385) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) 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.ConnectionImpl.getInstance(ConnectionImpl.java:381) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at DAO.dbconnection2.<init>(dbconnection2.java:16) at action.testsendaction.execute(testsendaction.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ``` dbconnection2.java 是创建连接,代码如下: ``` package DAO; import java.sql.Connection; import java.sql.DriverManager; public class dbconnection2 { private static final String DRIVER = "com.mysql.jdbc.Driver"; private static final String URL = "jdbc:mysql://*******:3306/mas?useUnicode=true&characterEncoding=gb2312"; private static final String USER = "ywz"; private static final String PASSWORD = "yw690"; private Connection con; public dbconnection2() throws Exception{ Class.forName(DRIVER); this.con = DriverManager.getConnection(URL, USER, PASSWORD); } public Connection getConnection() { return this.con; } public void closecon() throws Exception { if(this.con != null) { try { this.con.close(); } catch(Exception e) { throw e; } } } } ``` action代码: ``` public class testsendaction extends ActionSupport{ private String list; public String getList() { return list; } public void setList(String list) { this.list = list; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } private String content; public String execute() throws Exception{ dbconnection2 dbc2 = new dbconnection2(); Statement s1 = dbc2.getConnection().createStatement(); Random ran = new Random(); String pwd = ""; for(int i=0;i<6;i++) { pwd += ran.nextInt(10)+""; } System.out.println("ranpwd="+pwd); String mess = "本信息来自工资查询系统,用于用户的首次登陆,登陆密码为:"+pwd+" ,登陆成功后,请自行修改密码。"; String send = "insert into api_mt_6(mobiles,content) values('"+list+"','"+mess+"')"; s1.executeUpdate(send); System.out.println("send:"+send); s1.close(); dbc2.closecon(); return SUCCESS; } } ``` 报错是在数据库连接的new语句上。 连接最后也有关闭。但是就是不能进行二次访问数据库。只能重启下tomcat,然后又可以登录一次,第二次也无法连接了。 找了好久都没发现原因,希望大家帮帮忙 ,谢谢了!
java 编程中MySQL存储问题?
在java中遇到的MySQL存储问题,String time = "2018-12-09 10:27:25"; String sql = "insert into flux values('11','22','2018-12-09 10:27:25','44') "; 这样可以插入,String time = "2018-12-09 10:27:25"; String sql = "insert into flux values('11','22',"+time+",'44') "; con.executeSql(sql);却显示错误,错误信息: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 '10:27:25,'44')' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 求大神指导
mybatis调用mysql存储过程时报错
<parameterMap type="java.util.Map" id="callMap"> <parameter property="pId" jdbcType="VARCHAR" mode="IN"/> <parameter property="colName" jdbcType="VARCHAR" mode="IN"/> <parameter property="colPname" jdbcType="VARCHAR" mode="IN"/> <parameter property="tName" jdbcType="VARCHAR" mode="IN"/> <parameter property="outColName" jdbcType="VARCHAR" mode="IN"/> <parameter property="retVal" jdbcType="VARCHAR" mode="OUT"/> <parameter property="userCount" jdbcType="INTEGER" mode="OUT"/> </parameterMap> <select id="getChildDeptAndCountByParentId" parameterMap="callMap" statementType="CALLABLE" > {CALL pro_getChildList( #{pId,jdbcType=VARCHAR,mode=IN}, #{colName,jdbcType=VARCHAR,mode=IN}, #{colPname,jdbcType=VARCHAR,mode=IN}, #{tName,jdbcType=VARCHAR,mode=IN}, #{outColName,jdbcType=VARCHAR,mode=IN}, #{retVal,jdbcType=VARCHAR,mode=OUT}, #{userCount,jdbcType=INTEGER,mode=OUT} )} </select> 在本机跟测试mysql 5.6.36中可以正常运行,但放到生产环境中,mysql版本为5.6.44时会抛出错误 std [0523 14:45:27 ERROR: druid.sql.Statement - {conn-10020, cstmt-20014} execute error. {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} 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 ')' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) at com.mysql.jdbc.Util.getInstance(Util.java:382) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362) at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) at com.sun.proxy.$Proxy38.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId(<generated>) at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) std [0523 14:45:27 ERROR: com.alibaba.dubbo.rpc.filter.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 172.21.4.80. service: com.concom.yunzq.service.user.IDepartmentService, method: queryChildDeptAndCountByParentId, exception: org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: 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 ')' at line 1 ### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml] ### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMap ### The error occurred while setting parameters ### SQL: {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} ### Cause: 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 ')' at line 1 ; bad SQL grammar []; nested exception is 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 ')' at line 1, dubbo version: 2.8.4, current host: 172.21.4.80 org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: 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 ')' at line 1 ### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml] ### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMap ### The error occurred while setting parameters ### SQL: {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} ### Cause: 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 ')' at line 1 ; bad SQL grammar []; nested exception is 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 ')' at line 1 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447) at com.sun.proxy.$Proxy38.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId(<generated>) at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: 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 ')' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) at com.mysql.jdbc.Util.getInstance(Util.java:382) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362) at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) ... 40 more
java向mySql插入数据乱码
![图片说明](https://img-ask.csdn.net/upload/201601/18/1453093179_952661.png) 为什么我执行以下命令行后暂时成功改成了utf8,但是退出mysql后重新进入又变成gbk编码了呢 mysql> SET character_set_client = utf8; mysql> SET character_set_results = utf8; mysql> SET character_set_connection = utf8;
使用kafka connect ,mysql作为输入,输出也是mysql 报错record value schema is missing
使用kafka connect ,mysql作为输入,输出也是mysql 报错record value schema is missing 报错代码如下: [2019-10-31 14:37:32,956] ERROR WorkerSinkTask{id=mysql-sink-0} Task threw an uncaught and unrecoverable exception. Task is being killed and will not recover until manually restarted. (org.apache.kafka.connect.runtime.WorkerSinkTask:544) org.apache.kafka.connect.errors.ConnectException: PK mode for table 'dim_channel_copy' is RECORD_VALUE, but record value schema is missing     at io.confluent.connect.jdbc.sink.metadata.FieldsMetadata.extractRecordValuePk(FieldsMetadata.java:238)     at io.confluent.connect.jdbc.sink.metadata.FieldsMetadata.extract(FieldsMetadata.java:102)     at io.confluent.connect.jdbc.sink.metadata.FieldsMetadata.extract(FieldsMetadata.java:64)     at io.confluent.connect.jdbc.sink.BufferedRecords.add(BufferedRecords.java:71)     at io.confluent.connect.jdbc.sink.JdbcDbWriter.write(JdbcDbWriter.java:66)     at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:69)     at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:524)     at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:302)     at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:205)     at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:173)     at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:170)     at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:214)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at java.lang.Thread.run(Thread.java:748) [2019-10-31 14:37:32,957] ERROR WorkerSinkTask{id=mysql-sink-0} Task threw an uncaught and unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask:172) org.apache.kafka.connect.errors.ConnectException: Exiting WorkerSinkTask due to unrecoverable exception.     at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:546)     at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:302)     at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:205)     at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:173)     at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:170)     at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:214)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.kafka.connect.errors.ConnectException: PK mode for table 'dim_channel_copy' is RECORD_VALUE, but record value schema is missing     at io.confluent.connect.jdbc.sink.metadata.FieldsMetadata.extractRecordValuePk(FieldsMetadata.java:238)     at io.confluent.connect.jdbc.sink.metadata.FieldsMetadata.extract(FieldsMetadata.java:102)     at io.confluent.connect.jdbc.sink.metadata.FieldsMetadata.extract(FieldsMetadata.java:64)     at io.confluent.connect.jdbc.sink.BufferedRecords.add(BufferedRecords.java:71)     at io.confluent.connect.jdbc.sink.JdbcDbWriter.write(JdbcDbWriter.java:66)     at io.confluent.connect.jdbc.sink.JdbcSinkTask.put(JdbcSinkTask.java:69)     at org.apache.kafka.connect.runtime.WorkerSinkTask.deliverMessages(WorkerSinkTask.java:524)     ... 10 more [2019-10-31 14:37:32,958] ERROR WorkerSinkTask{id=mysql-sink-0} Task is being killed and will not recover until manually restarted (org.apache.kafka.connect.runtime.WorkerTask:173) [2019-10-31 14:37:32,958] INFO Stopping task (io.confluent.connect.jdbc.sink.JdbcSinkTask:100)
在jae上搭建的Java项目,连接mysql乱码,本地没问题
云数据库上显示的编码是utf-8,java连接mysql用的也是utf-8,在本地连接mysql没有任何问题,在jae上就出问题,哪位朋友遇见过同样的问题吗?
java mysql 修改不成功 没反应 也不报错
public class xiu { private static int id; public static void main(String[] args) { Connection connection; PreparedStatement stmt; String URL = "jdbc:mysql://rm-2ze1h274pv1j5xbc58o.mysql.rds.aliyuncs.com:3306/cww"; String USER = "cww"; String PASSWORD = "grj5201314!"; String sql = "Update 测试1 Set id=?, username = ? where password = ?"; try { Class.forName("com.mysql.cj.jdbc.Driver"); connection = DriverManager.getConnection(URL, USER, PASSWORD); stmt = connection.prepareStatement(sql); stmt.setInt(1, 2); stmt.setString(2,"chand"); stmt.setString(3, "464845"); stmt.executeUpdate(); stmt.close(); }catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } ![图片说明](https://img-ask.csdn.net/upload/201909/06/1567759705_195988.png)
java读取MySQL中的中文数据显示乱码
在linux平台(Ubuntu 10.10)上安装MySQL(5.1)和JDK(1.6),然后使用PuTTY远程操作.只将PuTTY的Window -> Translation 中的"Received data assumed to be in which character set"属性改成UTF-8后就能正常显示和输入中文,单独使用MySQL或是java都没有问题,但是现在发现一但让java读取MySQL中的含中文的数据并显示就成了乱码. 具体一点就是这样: 在java中 System.out.println("中文"); 编译并执行这样的语句没有问题. 在MySQL中,执行 INSERT INTO table_mast (NO, name, post) VALUES ( "13","网管","管理员"); 再执行 SELECT * FROM table_mast; 也能显示正常的中文. 但是编译执行下面的java就显示乱码: try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1/mytest?" + "user=root&password=123456"); Statement stmt = conn.createStatement(); ResultSet rs = null; if (stmt.execute("SELECT * FROM table_mast")) { rs = stmt.getResultSet(); } while(rs.next()) { System.out.println(rs.getString("NO").trim()); System.out.println(rs.getString("name").trim()); System.out.println(rs.getString("post").trim()); if (rs != null) { rs.close(); } rs = null; if (stmt != null) { stmt.close(); } stmt = null; } } catch(......) { ...... } 请问这是什么原因?用什么方法能避免乱码的出现?
Kafka实战(三) - Kafka的自我修养与定位
Apache Kafka是消息引擎系统,也是一个分布式流处理平台(Distributed Streaming Platform) Kafka是LinkedIn公司内部孵化的项目。LinkedIn最开始有强烈的数据强实时处理方面的需求,其内部的诸多子系统要执行多种类型的数据处理与分析,主要包括业务系统和应用程序性能监控,以及用户行为数据处理等。 遇到的主要问题: 数据正确性不足 数据的收集主要...
volatile 与 synchronize 详解
Java支持多个线程同时访问一个对象或者对象的成员变量,由于每个线程可以拥有这个变量的拷贝(虽然对象以及成员变量分配的内存是在共享内存中的,但是每个执行的线程还是可以拥有一份拷贝,这样做的目的是加速程序的执行,这是现代多核处理器的一个显著特性),所以程序在执行过程中,一个线程看到的变量并不一定是最新的。 volatile 关键字volatile可以用来修饰字段(成员变量),就是告知程序任何对该变量...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
GitHub开源史上最大规模中文知识图谱
近日,一直致力于知识图谱研究的 OwnThink 平台在 Github 上开源了史上最大规模 1.4 亿中文知识图谱,其中数据是以(实体、属性、值),(实体、关系、实体)混合的形式组织,数据格式采用 csv 格式。 到目前为止,OwnThink 项目开放了对话机器人、知识图谱、语义理解、自然语言处理工具。知识图谱融合了两千五百多万的实体,拥有亿级别的实体属性关系,机器人采用了基于知识图谱的语义感...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
微信支付崩溃了,但是更让马化腾和张小龙崩溃的竟然是……
loonggg读完需要3分钟速读仅需1分钟事件还得还原到昨天晚上,10 月 29 日晚上 20:09-21:14 之间,微信支付发生故障,全国微信支付交易无法正常进行。然...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
相关热词 c# clr dll c# 如何orm c# 固定大小的字符数组 c#框架设计 c# 删除数据库 c# 中文文字 图片转 c# 成员属性 接口 c#如何将程序封装 16进制负数转换 c# c#练手项目
立即提问