Mybatis3使用JdbcOdbc驱动检索MS Access报No data found exception的解决方法
来源:互联网 发布:抽奖算法提高概率 编辑:程序博客网 时间:2024/06/07 09:22
原因:
This typically occurs when you try to read the value of a column multiple times. For example, this may throw "No data found":
ResultSet rs = statement.executeQuery(sql);while (rs.next()) { if ("value1".equals(rs.getString("mycolumn")) || "value2".equals(rs.getString("mycolumn"))
只有jdbc-odbc桥接会有只能取一次值的这个问题,其他Jdbc驱动无。
private void printColumnValues(int columnCount) throws SQLException {
StringBuilder row = new StringBuilder();
row.append("<== Row: ");
for (int i = 1; i <= columnCount; i++) {
String colname;
try {
colname = rs.getString(i);
..........
也就是在正式从rs.getString取值前,ResultSetLogger已经调用过一次,所以会报No data found Java exception
解决方法:
log4j.properties 添加一行 log4j.logger.java.sql.ResultSet=ERROR
让ResultSetLogger在出错情况外不执行即可。
0 0
- Mybatis3使用JdbcOdbc驱动检索MS Access报No data found exception的解决方法
- java连接access数据库调用getString方法报错java.sql.SQLException: No data found
- 触发器ORA-01403: no data found的解决方法
- Spring Data JPA - “No Property Found for Type” Exception
- 谈一谈JPA遇到的:JUnit神奇的报错 java.lang.Exception:No tests found matching
- 测试代码的报错java.lang.Exception: No tests found matching Method ***
- 谈一谈JUnit神奇的报错 java.lang.Exception:No tests found matching
- Junit报错:java.lang.Exception: No tests found matching
- 使用junit4报“no Junit tests found”的错误
- Oracle10g 报错'java.lang.Exception: No such metric'的解决方法
- (2010-06-12) Oracle10g 报错'java.lang.Exception: No such metric'的解决方法
- Oracle10g 报错'java.lang.Exception: No such metric'的解决方法
- 有问题的(no data found)
- tomcat启动时卡死,报:WARN No appenders could be found for logger的解决方法
- 关于DB2数据库报java.sql.SQLException: No suitable driver found异常的原因及解决方法
- No module ata_piix found的解决方法
- No module ata_piix found的解决方法
- PHP命名空间中使用Exception报错not found
- Libcmt冲突问题
- Http post方式发送json数据
- ubuntu 14.04 adt-bundle 无法识别android手机的解决方法
- setTextColor()的参数设置方式
- 【CF】CodeForces 348A Mafia
- Mybatis3使用JdbcOdbc驱动检索MS Access报No data found exception的解决方法
- linux syscore suspend/resume方法
- VC 运行时库 /MD、/MDd 和 /MT、/MTd
- bug修复日记---------玩家信息被重复写入数据库
- hdu_1054 Strategic Game(动态规划与二分图两种解法)
- Unity 动画(UITweener)、协程(Coroutine)和委托(Delegate)队列管理
- 1-1. Interview Guide
- Linux下vsFTP配置全方案(限制用户/端口/速度/空间)
- Gentoo文档翻译——安装Gentoo(2) 硬件要求