Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » Oracle  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 java如何访问Oracle的long类型
kingtrue





发贴: 61
积分: 0
于 2006-06-07 14:27 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我现在想用一个字段来存长字符串(在于4000,varchar2不能满足),想到用LONG,但是用JDBC连的时报SQL不正确,请高人指点,相当紧急!!!!


作者 Re:java如何访问Oracle的long类型 [Re:kingtrue]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-06-07 18:39 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Do a search with Google... e.g.
Sample demonstrating the usage of LONG type
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/basic/LongSample/Readme.html


// Populate the ResultSet
while(resultSet.next()) {
InputStream insurancedata; // Holds the LONG data
StringBuffer dataBuffer = new StringBuffer();

/* Obtain the LONG data into a byte array. LONG data can be accessed in
two ways: 1) By retrieving all the data in one shot (getBytes method)
2) By using streams. The LONG data is made available to the program
as an Ascii or Unicode stream, and the data can be retrieved chunk by
chunk, which is more eficient in terms of memory usage
In this sample we illustrate retrieval using streams */
insurancedata = resultSet.getAsciiStream(1);
while((chunk = insurancedata.read()) != -1) {
dataBuffer.append((char)chunk);
}




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923