读取oracle blob字段时,我读取后set到一个类的属性中,然后再get的时候就得不到了
java.sql.SQLException: 关闭的连接。
在 Blob content_blob= s.getcontent();时,出现连接关闭,本不应该这样的,一个get方法怎么会出现连接关闭,使我百思不得其解,郁闷了好半天,最后在调用的方法中将关闭的方法,即st.close(),rs.close()等都给屏蔽掉,再运行就好了。
在网上查了好一会儿,最后看到以下这段话:
“此段代码可以顺利的无异常的执行。由此我推测认为,主要是因为 resultset ,connection关闭引起的。这说明,在执行了查询操作之后,我们虽然可以得到一个blob对象,但是实际的内容并没有读入内存,也就是说,并没有读如到blob对象中,而此blob对象也就相当于一个对数据库中blob字段操作的一个引用,所以,此时,如果想从blob字段中读取数据,还是需要数据库连接的。
而上面的封装操作之后,数据库连接已经中断,所以,再读取数据时,就发生了异常。
”
以上红字问题也许可以说明原因。
所以得到查询集合后还是不能关闭,暂时到此,至于不关闭不会不造成垃圾或其他问题,再说吧。遇到问题再解决。
分享到:
相关推荐
java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK ……
NULL 博文链接:https://listen-raining.iteye.com/blog/1962065
在oracle里面运行一下,解决Exception java.sql.SQLException ORA-00600 内部错误代码
服务器出现java.sql.SQLException No suitable driver found for 的
NULL 博文链接:https://zhang-zling.iteye.com/blog/980488
oracle 10g 数据库驱动下载:oracle jdbc dirver
oracle ora-各种常见java.sql.SQLException归纳
java.sql.SQLException: null, message from server: “Host ‘223.72.41.7’ is not allowed to connect to this MySQL server” 客户端访问时报错: 解决方法: 1,登陆服务器 mysql> use mysql; //用mysql ...
本文主要介绍了关于MySQL存储表情报错:java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x92\xA9\x0D\x0A…’的相关解决方法,分享出供大家参考学习,下面话不多说了,来一起看看详细的介绍: ...
Q: I am working with ... I am using updateBinaryStream method of resultset to update the BLOB field but it is failing after giving following exception java.sql.SQLException: Internal Error: Unable to
主要给大家介绍了关于MySQL存储表情时报错:java.sql.SQLException: Incorrect string value: 'xF0x9Fx92xA9x0Dx0A...'的解决方法,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面来一起看看吧。
mysql5.6连接驱动jaf,可处理报错java.sql.SQLException: No suitable driver
java.sql.SQLException: Operation not allowed after ResultSet closed java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
异常错误:java.sql.SQLException: The server time zone value ‘?й???’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTime...
绝对好用的9i驱动包+10g驱动包 解决java.sql.SQLException: 不支持的特性 解决oracle.jdbc.driver.OracleDatabaseMetaData.supportsGetGeneratedKeys()Z异常 等等
已成功与服务器建立连接,但是在登录过程中发生错误 (provider: 共享内存提供程序, error: 0 - 管道的另一端上无任何进程。) 用户 'sa' 登录失败。该用户与可信 SQL Server 连接无关联。 说明: 执行当前 Web 请求...
问题是这样的…我在VS2008直接运行打开网页,可以连接数据库…但通过输入地址,也可以打开网页,但涉及数据库就出问题… 无法打开登录所请求的数据库 “TakeClass”。登录失败。 用户 ‘2D2727E2578F446\ASPNET’ 登录...
java连接oracle的数据库驱动,复制进项目就能使用.欢迎下载
import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; /** * @author Administrator * */ public class sqlServer { String DBDriver=...