在Java Servlet 中如何获取Oracle中long数据类型的数据

Jking 2001-05-21 09:34:00
各位老师:

我想问在Java Servlet 中如何获取Oracle中long数据类型的数据.

...全文
91 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
skyyoung 2001-05-21
  • 打赏
  • 举报
回复
4. Streams: Long columns in JDBC are streamed.


* To set a long (Stream) column
pstmt.setAsciiStream (1, <input-stream>, <input-stream-length>);

If the string data is in Unicode format, then use setUnicodeStream.
pstmt.setUnicodeStream (1, <input-stream>, <input-stream-length>);

For long raw columns, use setBinaryStream
pstmt.setBinaryStream (1, <input-stream>, <input-stream-length>);



create table streamexample (data long)

PreparedStatement pstmt =
conn.prepareStatement ("insert into streamexample values (?)");
InputStream is = new FileInputStream ("notes.txt");
File file = new File ("notes.txt");
pstmt.setAsciiStream (1, is, (int)file.length ());


* To retrieve a long column
ResultSet rset =
stmt.executeQuery ("select * from streamexample");

InputStream ascii_data = rset.getAsciiStream (1);

// Loop, reading from the gif stream and writing to the file
int c;
while ((c = ascii_data.read ()) != -1)
Systemm.out.print(c);

Jking 2001-05-21
  • 打赏
  • 举报
回复
用getString()在运行时会产生内存冲突错误,把weblogic服务器停止,可能是数据太多的原因。
emily_wang 2001-05-21
  • 打赏
  • 举报
回复
getString().

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧