java.sql.SQLException:Invalid value for getInt()-'zhangsan'
2015-02-11 21:41
330 查看
1、错误描述
java.sql.SQLException:Invalid value for getInt()-'zhangsan'
2、错误原因
在遍历打印查询结果时,rs.getInt(3),而在数据库中对应的该字段却是varchar类型,Java端和数据库表中的数据类型不一致,导致出错
3、解决办法
将“rs.getInt(3)”修改成“ rs.getString(3)”
java.sql.SQLException:Invalid value for getInt()-'zhangsan'
2、错误原因
在遍历打印查询结果时,rs.getInt(3),而在数据库中对应的该字段却是varchar类型,Java端和数据库表中的数据类型不一致,导致出错
3、解决办法
将“rs.getInt(3)”修改成“ rs.getString(3)”
相关文章推荐
- Caused by: java.sql.SQLException: Invalid value for getInt()
- 在对数据库进行操作时,控制台报错:java.sql.SQLException: Invalid value for getInt() - '电子书';
- java.sql.SQLException:Invalid value for getInt()-'zhangsan'
- JavaWeb报错:java.sql.SQLException: Invalid value for getInt()
- Caused by: java.sql.SQLException: Incorrect integer value: '' for column 'clientId' at row 41
- java.sql.SQLException: Incorrect integer value: '' for column 'id' at row 1
- java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column 'groupName'
- java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column body
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)的一种解决方法
- java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date 解决方法
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value .
- 解决:java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES)
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
- java.sql.SQLException: Incorrect string value: '\xE5\x90\x88\xE8\xAE\xA1' for column
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
- java.sql.SQLException: Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'xxx' 无效
- java.sql.SQLException: ORA-06553: PLS-307: too many declarations of 'GET_PROFILE_VALUE' match this call
- 问题解决:java.sql.SQLException:Value '0000-00-00' can not be represented as java.sql.Date
- mysql 数据库字段为datetime类型时默认值为:0000-00-00 00:00:00 查询时异常 java.sql.SQLException:Value '0000-00-00' can not be represented as java.sq