很长时间不写代码动手能力明显下降很多常见的错误还是经常发生,今天吐血了一次。

  简单的坑总是要多跳几次才能甘心。很清晰的记得大学的时候在此坑差点闷死,现在又跳进这个坑了,搞了半天终于知道错在哪里。

String sqlString = "insert into cryptcontent(content,assistentContent) value('asf','asfd')";
DBHelper.insertQuery(sqlString);

  这样操作可以的。因此占位符应该也没问题,前提占位符使用正确。代码如下(错误的):

String sqlString = String.format(
"insert into cryptcontent(content,assistentContent) value(%s,%s)",
assistantEncryptResultString, valueString);
DBHelper.insertQuery(sqlString);

此时怎么调试都报错,然后进行调试,报错如下:
  com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'afsdf' in 'field list'

Debug 调试出现:insert into cryptcontent(content,assistentContent) value(afsdf,asfasfd )

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmYAAAChCAIAAADiPOT4AAAdRElEQVR4nO2d7W8bx53H98/oi7y59tqmpwNcQWkc0+ciyAF5U6FXOGnk2gWsAAcVkWu/uHMugIyLXLgBjLZnszaQXC04le8kW61zQoO46lVnl2VrWyJsi7IkSnx+lEQ9UaRkSwHytPdiyeXs7OzskFxyueL3i88LabkzO/PbmfnuzC650scff7y7u/v06dOtra1cLre6uto77AEAAABanHQ6nc1m19fXNzc3C4XC9va2tLu7u7Oz8+TJk3w+v7a2trS01DvskSEIgiCohdU77InFYplMZmVlZWNjI5/PFwoFaWdn5+nTp9vb25ubm6urq+l0GpYJQRAEtbh6hz3hcDiVSi0vL6+treVyuXw+LylTzEKhsLGxkc1mk8kkLBOCIAhqcfUOexYWFuLxuDrR3NzclJQpZj6fX19fX1paisfjsEwIgiCoxdU77Jmbm4tGo+l0WplobmxsSE+ePNna2lJWZRcXF2OxGCwTgiAIanH1DntmZmbC4XAymVxcXFxZWVlfX5e2t7eVZ2VXVlYymUw0GoVlQhAEQS2u3mHP9PR0MBhU1maz2eza2pq0vb2t3shMpVLhcLh32CPLqaoJhTwAAABAAxD2JrlQoXqHPX6/f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ZLUv4NBoOhUCgcDkcikVgslkgkkslkOp1W5peqX+bzeWl3d5dyzVwut76+vrq6ms1ml5eXFxcXM5lMKpVKJpOJREKxz2g0GrFE972v/dgruO9froy+dmVG/zdfzx8eqn27slH/0fOHh/iIlNA2cYOvVtm0UuQWflSNwshJy8+cypDaoer46zM0LZtpVkZbqEMYxNn3L4f/8Bvi/0rbf43nkZmQuYVTU3FZFX9OPvqmyAmIfjd+wSoqJGS7otFoLBaLx+OKU6ZSqUwmo0wuKb8sFArSxx9/vLu7+/Rpsv/Y2D8c/f3Bo7cO/uCjM9enf/ivfmW6mR33Hnjtgxe+f/PfxjLpsTsvvDqy/9WR/afuJRKJROLR6Vdu7H/lxv5XPvylL5FIJBK+u0eULe88+uCdG/tfuXHk6vy9qx/uL+5248jV+URRalqCk3cThKiE965+qCYv/v3ROCvnBJ0tAblPgiVqH9N8+LmVpUbmlRv7Xxk//c6N0x+VP1RipX76gWHCG/vfeaTJthSB0x+V/9aGURPn01fvHlE/9d09cvIuGWSySIIVFImP+q/+D2offSbMJNRGZv7888UXefQqmhCnwKZ10VcqkUgkEo9Oa1sF2RcSiQTVEYrnlGoq3DLzz6O+wKZVaJ74GxXPKAmzcYo0S34xoKZVMplUnDKdTpNmqTzvs7Gxofrl9vb2/wP9Zrl9mb4DMgAAAABJRU5ErkJggg==" alt="" />

错误找到:注意后面value中的varchar类型的列的字段值没有单引号。故修正:

String sqlString = String.format(
"insert into cryptcontent(content,assistentContent) value('%s','%s')",
assistantEncryptResultString, valueString);
DBHelper.insertQuery(sqlString);

然后执行成功。

JAVA字符串格式化-String.format()的使用

吐槽 MySQL数据库jdbc操作,varchar类型占位符问题——单引号造孽的更多相关文章

  1. MySql数据库,对varchar类型字段str进行where str=0条件查询时,查询结果是什么

    在用MySQL查询数据的时候,遇到了一个奇怪的问题.用一个varchar类型的字符串str,作为条件与0比较时,会查str不为0的数据. 比如:SELECT id, idnumber from hr_ ...

  2. mysql数据库日期是varchar类型的时间比较查询

     单纯的字符串比较结果不精确. select * from 表明 where times> '2088/12/8 10:02:40' (×) 转换函数如下(数据库为varchar): selec ...

  3. Mysql一个非常有用的内置函数今天碰到要把MySQL数据库中的varchar转换成date类型进

    Mysql一个非常有用的内置函数 今天碰到要把MySQL数据库中的varchar转换成date类型进行时间的比较和查询.在网上找了找,发现MySQL也跟其他数据库一样有自己内置的转换函数:str_to ...

  4. DBA必备:MySQL数据库常用操作和技巧

    DBA必备:MySQL数据库常用操作和技巧 2011-02-25 15:31 kaduo it168 字号:T | T MySQL数据库可以说是DBA们最常见和常用的数据库之一,为了方便大家使用,老M ...

  5. MySQL中怎么对varchar类型排序问题

    MySQL中怎么对varchar类型排序问题 在mysql默认order by 只对数字与日期类型可以排序,但对于varchar字符型类型排序好像没有用了,下面我来给各位同学介绍varchar类型排序 ...

  6. MySQL数据库数据类型之集合类型SET测试总结

    MySQL数据库提供针对字符串存储的一种特殊数据类型:集合类型SET,这种数据类型可以给予我们更多提高性能.降低存储容量和降低程序代码理解的技巧,前面介绍了首先介绍了四种数据类型的特性总结,其后又分别 ...

  7. Mysql order by 排序 varchar 类型数据

    Mysql order by 排序 varchar 类型数据 varchar 类型字段排序,  会將数字当成字符串来处理.  排序规则一般是从左到右一位位来比较. +0之后 就转化成INT 类型排序 ...

  8. MySQL 数据库高级操作 (配图)

    MySQL数据库高级操作 1.一键部署mysql 数据库 2.数据表高级操作 3.数据库用户管理 4.数据库用户授权 1.首先一键部署mysql 数据库 : 可以看我之前的博客 https://www ...

  9. zabbix数据库mariadb从服务器迁移到云mysql数据库的操作

    zabbix数据库mariadb从本机迁移到云mysql数据库的操作 1.将zabbix数据库导出,并导入到云数据库中 由于数据库较大,如果直接使用shell会话中断会导致数据库导出或者导入失败,使用 ...

随机推荐

  1. ubuntu 12.10 apt-get 源

    更改apt-get源配置文件/etc/apt/sources.list 用一下内容替换掉 deb http://mirrors.163.com/ubuntu/ precise main restric ...

  2. 设计模式中类的关系之实现(Realization)

    实现关系是用来描述接口和实现接口的类或者构建结构之间的关系,接口是操作的集合,而这些操作就用于规定类或者构建结构的一种服务. 在接口和类之间的实现关系中,类实现了接口,类中的操作实现了接口中所声明的操 ...

  3. php 批量插入字段

    foreach ($_POST as $key => $value){ $array[] = "add ".$key." varchar(220),"; ...

  4. HBuilder 连接 夜神安卓模拟器

    由于HBuilder的自动扫描机制无法直接连上夜神模拟器,需要通过cmd命令窗口手动处理,才能将两者建立连接. 首先,启动HBuilder和夜神模拟器 然后,打开cmd命令提示符 cd进入夜神模拟器b ...

  5. 杂项收集,包括-发邮件、二维码生成、文件下载、压缩、导出excel

    本篇就最近工作解决的问题做个代码收集.包括以下几个方面:发邮件.二维码生成.文件下载.压缩.导出excel.有一种可用的解决方法就好,不求全面,不求原理. 1.发邮件: 命名空间:System.Net ...

  6. python_selenium之第一个自动化脚本

    python_selenium之第一个自动化脚本 上一节介绍了xpath的使用,接下来完成第一个自动化脚本 一.步骤: 1. 这里使用火狐浏览器,首先打开火狐浏览器 2. 使浏览器窗口最大化 3.输入 ...

  7. JNI动态库生成、编译、查看相关简易资料

    有一篇好博文,大家可以看下http://www.cnblogs.com/zhangweia/archive/2010/09/16/1828176.html,我这里是参考其做的另外一个javah -cl ...

  8. shell 命令getopts用法

    写shell脚本常见sh test.sh -m 2 -d 3的写法 事例脚本: #!/bin/bash while getopts ":a:b:c:" arg #选项后面的冒号表示 ...

  9. 学生成绩管理系统【c】

    #include<stdio.h> #include<stdlib.h> #include<string.h> #include<conio.h> #d ...

  10. docker学习笔记(2) 构建镜像

    一.手动构建一个简单镜像 我们以构建nginx的docker镜像为例:手动构建镜像 docker pull centos    安装基础镜像docker run --name mynginx -it ...