最近在使用

compile 'com.j256.ormlite:ormlite-android:5.0'
compile 'com.j256.ormlite:ormlite-core:5.0'
数据库框架的时候,因为我的应用,在应用没有退出的时候,要频繁删除和创建数据库.遇到了一个bug,在应用不退出的时候,删除掉数据库
然后重新导入数据和创建数据库,有时候会不成功!
 错误异常为:
   java.sql.SQLException: Unable to run insert stmt on object ExcelBean
网上不管是国内还是国外都找了很多资料,也有人遇到类似的问题,但是没有相同的,后来通过不停的打log调试.发现,插入异常造成的
原因是数据和表没有创建成功!
excelDaoOpe = excelSqliteOpenHelper.getDao(ExcelBean.class);
excelDaoOpe.create(excelBean);
发现.有时候getDao()这个方法不走,但是我明明在插入之前把之前的
excelDaoOpe 置为null,重新创建了,遇到这个问题很奇葩,原因有时候这个框架的底层没有调用 创建数据库的方法
  后来我的解决办法是:
  
ExcelSqliteOpenHelper helper=new ExcelSqliteOpenHelper(ExcelActivity.this);SQLiteDatabase writableDatabase = helper.getWritableDatabase();helper.onCreate(writableDatabase);
自己直接调用底层代码,自己在插入之前创建了这个数据库.从而问题得到了解决!

java.sql.SQLException: Unable to run insert stmt on object 解决办法相关推荐

  1. 【问题篇】Springboot解决报错“java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_passw”

    场景:从代码仓库拉取以前的代码,运行时发现报错"java.sql.SQLException: Unable to load authentication plugin 'caching_sh ...

  2. Caused by: java.sql.SQLException: Unable to open a test connection to the given database报错无法打开到给定数据库

    在启动hive或则其他要连接数据库的时候 ,都有可能遇到这个问题 [hadoop@hadoop001 bin]$ ./hive Caused by: java.sql.SQLException: Un ...

  3. java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password‘.

    错误描述 java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.at com.mysq ...

  4. 项目实战解决 java.sql.SQLException: Unable to load authentication plugin ‘caching_sha2_password‘.

    连接的安装的msql 数据库和连接数据库的代码jar包 不一致到 我这边myql 8的版本 <!--访问mysql--><!--JDBC--><!-- MySql 5.5 ...

  5. Caused by: java.sql.SQLException: Column ‘某个字段‘ cannot be null

    完整报错提示: 2020-10-10 18:14:00.139 INFO 13760 --- [nio-8082-exec-9] biz.xcj.conf.db.DataSourceAspect : ...

  6. Oracle Caused by: java.sql.SQLException: sql injection violation, syntax error: syntax error, expect

    参考:https://blog.csdn.net/qq_36326332/article/details/102938147 https://blog.csdn.net/fly_captain/art ...

  7. java.sql.SQLException: 关闭的连接 解决办法

    程序如果长时间不进行数据库操作,那么数据源中的 Connection 很可能已经断开.其原因有可能是防火墙,或者连接的数据库设置的超时时间.这里使用的是 C3P0 连接 oracle 数据库,引起的异 ...

  8. java.sql.SQLException: 要执行的 SQL 语句不得为空白或空值

    用mybatis执行sql的时候报错了,错误日志如下 org.springframework.jdbc.UncategorizedSQLException: ### Error updating da ...

  9. java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents 解决方法

    转载自https://blog.csdn.net/weixin_37577564/article/details/80329775 在JDBC使用的时候有时候会出现java.sql.SQLExcept ...

最新文章

  1. 在非互联网公司?!算法工程师的工作内容及心得建议
  2. Vue 组件通信之 Bus
  3. Django框架学习索引
  4. 举例浅介grep、sed、awk
  5. 谁来谈谈Google Earth的核心技术和架构?(转)
  6. matlab中textread 函数
  7. Redis进阶-Redis 4种MQ 方案对比
  8. 自定义LocaleResolver实现页面中英文切换
  9. swift3.0 Runtime 增加属性
  10. NYOJ 士兵杀敌(四) 树状数组
  11. Java如何接收前端传来的多层嵌套的复杂json串
  12. python图片分析中央气象台降水量预报_php采集自中央气象台范围覆盖全国的天气预报代码实例...
  13. WS_EX_COMPOSITED是个BUG?
  14. java9学习之模块化
  15. 中介管理系统php源代码,PHP房产中介管理系统小程序源码8.0.5 后台+前端
  16. 潇洒老师教你注塑模具使用顶针油需要注意的问题
  17. 今日头条关键词文章热度和搜索指数的查询方法分享
  18. wps中怎么在奇数页的页眉中设置整本书的标题,而在偶数页中设置该章的标题,同时请问怎样修改页码的字体?
  19. SpringBoot整合Memcached缓存
  20. AI带你走进P图新时代

热门文章

  1. [网络安全自学篇] 一 web学习及异或解密
  2. Android 系统序列号从哪里来,以及客制化序列号
  3. 《人月神话》8 胸有成竹(Chaptor 8.Calling the Shot -The Mythical Man-Month)
  4. python mlagent 安装
  5. LINUX学习基础篇(十五)软件包管理
  6. android remoteviews 设置背景,理解RemoteViews
  7. Gitte (https://gitee.com/) 常用git指令--实例
  8. Idea在项目中新建项目
  9. Dev c++无法新建项目解决方法
  10. delphi控件切图界面闪烁_「这个控件叫什么」系列之加载占位图+页面指示器