我就是使用了getString没有错误啊?你检查检查又没有别的错误。实在不行用getClob看看
解决方案 »
- 如何控制下拉框显示条数
- java 项目 启动服务器的时候自动运行java类
- 关于urlclassloader 关闭jar包问题
- 怎样把Myeclipse中的web项目比较完整的打包?
- 关于分页问题
- 连接 oracle10错误问题(no suitable driver)
- sql 错误 急救1
- 求HQL语句
- 在客户端用jsp语言写一文本文件,怎么写?
- 日期的加减问题??用Java实现.
- 请问各位高人,怎样做才能使浏览过的网页不显示在浏览器的缓存中
- 请问在JSP网页中<%@ page contentType="text/html;charset=GBK" %>和<meta http-equiv="Content-Type" content="text/html; charset=GBK"
如果text字段是空的情况也要考虑进去
比如:
try {
// Create a result set containing all data from mysql_all_table
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM mysql_all_table");
// Fetch each row from the result set
while (rs.next()) {
boolean bool = rs.getBoolean("col_boolean");
byte b = rs.getByte("col_byte");
short s = rs.getShort("col_short");
int i = rs.getInt("col_int");
long l = rs.getLong("col_long");
float f = rs.getFloat("col_float");
double d = rs.getDouble("col_double");
BigDecimal bd = rs.getBigDecimal("col_bigdecimal");
String str = rs.getString("col_string");
Date date = rs.getDate("col_date");
Time t = rs.getTime("col_time");
Timestamp ts = rs.getTimestamp("col_timestamp");
InputStream ais = rs.getAsciiStream("col_asciistream");
InputStream bis = rs.getBinaryStream("col_binarystream");
Blob blob = rs.getBlob("col_blob");
}
} catch (SQLException e) {
}
但是一般来说只用如下getString方法:
try {
// Create a result set containing all data from my_table
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM my_table");
// Fetch each row from the result set
while (rs.next()) {
// Get the data from the row using the column index
String s = rs.getString(1);
// Get the data from the row using the column name
s = rs.getString("col_string");
}
} catch (SQLException e) {
}
这样做就不会出现异常。
用select * from talbename就OK了!