BLOB blob = null;
有错,,应是
Blob blob=rset.getBlob(1);
然后,
使用,,byte b[]=blob.getBytes(0,1024);自己设,下边有文档
getBytes(long pos, int length)
Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes.
有错,,应是
Blob blob=rset.getBlob(1);
然后,
使用,,byte b[]=blob.getBytes(0,1024);自己设,下边有文档
getBytes(long pos, int length)
Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes.
解决方案 »
- tomcat启动报错严重: Exception starting filter characterEncoding
- hibernate郁闷了。这要怎么获取值啊??????
- 求一web版 界面生成器(能生成、读取、修改设计好的界面)
- 类下 getclass()下的所有方法介绍
- jdom遍历xml时,如何获得当前节点的XPath值?
- 在struts中怎么引用自己创建的Resource Bundle
- rmi远程调用问题,找不到主机
- 没钱了,20分请教一个问题,急!!
- 在Struts的资源文件中的中文乱码问题
- 关于查询的优化
- java+oracle双循环问题,救命啊,救命啊
- filter中出现的小问题.请帮帮忙.不欢迎灌水!
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:temp", "test", "123456");
conn.setAutoCommit(false);
PreparedStatement pstmt = conn.prepareStatement(
"select content from javatest where name= ? for update");
pstmt.setString(1, "fankai");
pstmt.executeUpdate();
ResultSet rset = pstmt.executeQuery();
if (rset.next()) {
Blob blob = rset.getBlob(1);
}
//OutputStream o = blob.getBinaryOutputStream();
//InputStream in = blob.getBinaryStream();
byte b[]=blob.getBytes(0,1024);********报错
return b;
byte[] bytes ;
driverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:temp", "test", "123456");
conn.setAutoCommit(false);
java.sql.Blob blob = null; PreparedStatement pstmt = conn.prepareStatement(
"select content from javatest where name= ? for update");
pstmt.setString(1, "fankai");
pstmt.executeUpdate();
ResultSet rset = pstmt.executeQuery();
if (rset.next()) {
blob = rset.getBlob(1);
bytes =blob.getBytes(0,1024); }
这个我没有测,你试试吧
我的问题,你也看看吧
就是这这一行:bytes =blob.getBytes(0,1024);**************
b=blob.getBytes(1,blob.getLength());