由买买提看人间百态

topics

全部话题 - 话题: clob
1 (共1页)
t********k
发帖数: 808
1
实际上我曾试过oralce.sql.CLOB
但一用这,我连从数据库中取clob字段的值都出错
就是下面语句
oralce.sql.CLOB clob = (oracle.sql.CLOB)rs.getClob(1)
一执行到这
后面的语句都不执行了
没抛出异常
却去执行finally里的语句了
真是不懂
用下面的没事
Clob clob = rs.getClob(1)
另外我的同事用oracle.sql.CLOB没事
我的语句和他的没什么两样
Faint死我了
t********k
发帖数: 808
2
Clob clob = null;
String strTemp;
... //给strTemp赋了一文章的内容
clob.setString(1,strTemp)
执行到上面一句是出现如下错误
用的系统是Oracle9i
看了JDK,setString在1.4已经支持了
而我用的Bea Weblogic 8.1
用的是JDK1.4.1
为什么?
java.sql.SQLException: 不支持的特性
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBEr
ror.java:690)
at o
t********k
发帖数: 808
3
是先处理clob,用setString把String变量的值放到
clob里
然后用setClob
因为把所一文章里的文字放到clob字段内
h****r
发帖数: 2056
4
来自主题: Database版 - Help need on writing data to Oracle CLOB!
Hi everyone,
I was try to write data to CLOB by the way
(prepare/bind/exec) you suggested
on the Oracle Discussion Group. But I got some error, below
is the piece code,
I wonder if I am on the correct way to do it.
say I have a table ExampleTab which contain two columns,
{
Oid int
ClobData CLOB
}
I am try to insert data to clobData by below code, assume
alreay created a
record which has Oid : 101 and ClobData is a emptyClob.
void updateClob(const char* lobString)
{
SQLRETURN l
r*********t
发帖数: 4
5
来自主题: Database版 - long and CLOB.. any differences?
Long is a legacy datatype of Oracle and being replaced by CLOB and BLOB. Long
can store up to 2G data and CLOB can store 4G. You can't use WHERE, GROUP BY,
DISTINCT and some other SQL clause for Long datatype. IMHO It's reasonable
that WAS doesn't provide backward compatibility to Long. But I am sure about
he ejb2.0 standard thingy, you sure the 'long' in it is the same thing of Long
in Oracle?
m******t
发帖数: 2416
6

I'm sorry, I didn't realize you were using Clob.setString() already.
Never mind the second question.
I remember Oracle has some weird way of handling clobs and blobs. Last time I
had to do this, I had to downcast the drive to the oracle driver class and
call some proprietary methods on it. And that was around JDK 1.3.1 or so...
m**c
发帖数: 90
7

The Oracle 9i JDBC driver for JDK 1.4 is no longer "classes12.zip", it is
another one (you can find it in the same directory where "classes12.zip" can
be found inside Oracle installation directory).
Our product doesn't use JDK 1.4 yet, so we had to use "oracle.sql.CLOB"
object. Basically, you use "empty_clob()" first to do insert and then use
"select ... from ... where ... for update" and then retrieve CLOB data (should
be empty for the first time) and update it ("getCharacterOutputStream" met
b****e
发帖数: 1275
8
来自主题: Database版 - long and CLOB.. any differences?
is there any difference between these two datatypes in oracle?
ibm websphere doesn't support long in CMP and suggested us to
convert to CLOB.. while weblogic says long support is part of
ejb 2.0 and that they support it.
so what's the difference? thanks
m****a
发帖数: 2
9
来自主题: Database版 - How to read CLOB by sqlplus?
depends on the size of the CLOB
you may want set long first. e.g.
set long 5000
before you select
m******t
发帖数: 2416
10

I googled "oracle clob". There seems to be a lot of discussion (or whining if
you will) about it. You might want to check it out.
h****r
发帖数: 2056
11
The reason is I have to provide an updateDb API for other
people to
insert data to tens of differnet kind of table, and some
statement for
insert a record is definetly over 4k, use CLOB by
prepare/bind/exec will overcome the size problem, but
because every table has different coloums,
It is hard to provide an common updateDb API for all tables
by prepare/bind/exec.
for example,
table A is (Number, Number, CLOB),
table B is (Number, CLOB, string, CLOB);
we cannot provide a common updateDb API for
o**y
发帖数: 1466
12
来自主题: Database版 - 问一个SQL LOADER BLOB的问题
我在做一个项目,要求在1个小时的窗口内,把整个数据库全部更新一次(头的要求很奇怪
,要full,不能incremental).现在的瓶颈在一个BLOB的字段上,这个字段存放一个Object
Type,object不大,BLOB的长度在100-10000之间,但有2 million rows.整个BLOB全部加
起来也不大,只有200MB左右.
我在网上找的例子用SQL LOADER 做LOB,全部是文本CLOB的例子,看不到BLOB的例子,
BLOB的例子也有,但是都是从不同的文件载入的,比如说一条记录对应一个外部文件. 这
对我来说不现实,在本地盘上装2M个文件会慢得要死.我现在的办法是把BLOB变成BASE64
,到了ORACLE里面再把BASE64 decode成BLOB,这样可以把数据搞上去,但是这个数据内解
码耽误时间,速度达不到要求,很慢.
我希望的方法是把所有记录的BLOB内容放在一个文件里,然后用LOBFILE constant指定
一个文件名,所有的记录都在这个文件里找内容,现在的问题是我不知道怎么样把各条记
录的BLOB在一个文件里分割.ORACLE DOC上说可以... 阅读全帖
h****r
发帖数: 2056
13
Thanks, CLOB is up to 2G, I know this, but CLOB is use
prepare/store/execute
to insert, not using statement directly with a 2G string.
actually I want to
know what is the size limit of statement.
t******t
发帖数: 51
14
来自主题: Database版 - Help: Too Many Cursors in Oracle!!
I use JDBC to send CLOB objects to the database from my web application.
However, I quickly get a large number of dangling cursors. I searched the
cursor table and it shows it has a whole bunch of the following cursors open:
begin dbms_lob.trim (:1, :2); end;
I don't think I explicitly run the above script in my application. Where do I
get this? I do use oracle.sql.CLOB.trim() in my application (Java) code. Is it
related to the dbms_lob.trim thing?
Any suggestions are appreciated.
B*****g
发帖数: 34098
15
http://www.acs.ilstu.edu/docs/oracle/appdev.101/b10795/adfns_tr.htm
Example: Modifying LOB Columns with a Trigger
You can treat LOB columns the same as other columns, using regular SQL and
PL/SQL functions with CLOB columns, and calls to the DBMS_LOB package with
BLOB columns:
drop table tab1;
create table tab1 (c1 clob);
insert into tab1 values ('

HTML Document Fragment

Some text.');
create or replace trigger trg1
before update on tab1
for each row
begin
dbms_output.put_line('Ol

B*****g
发帖数: 34098
16
来自主题: Database版 - Oracle / DB2 问题
oracle
CREATE TYPE type_beijing_1 AS VARRAY (100) OF CLOB
or
CREATE TYPE type_beijing_2 AS VARRAY (100) OF VARCHAR2(32767)
32767 can not be used for sql, you have to change to 4000
why do you need array? I would rather use
CREATE TYPE type_beijing_3 AS TABLE OF CLOB
c*****t
发帖数: 1879
17
来自主题: Database版 - varchar (80) 比 varchar(800)的优势?
不清楚 SQL Server,但是俺从其他系统的角度来说一下。
每个 row 的最大是有限制的。比如说 32-64K 。这样的话,该 row 才有可
以放进一个 data block 里面。data block 是数据库的一个基本储存单位。
这个限制平常看不出来,但是当某个 table 有 1000 column 的话,就体现
出来了。数据库需要考虑到最糟糕的情况,所以如果超过了 row size limit,
就可以拒绝接受该 create table 。这时候就需要对 varchar 的长度精打细算。
PostgreSQL 里面的 text 是介于 varchar 和 clob 之间。当 text 的长度
较小的时候,该文字可以放进 row 里面。较大的时候(比如超过 2000),
就开始先 compress 一下。还是太大的话,用类似 clob 的办法存。当然
这几种办法就没有读写短的 varchar 那么快。
至于 index,其实也就是一个小点的 table ,读写的速度很重要。而越长
的 varchar 的读写也越花时间。事实上除非是 unique index,太长的
va... 阅读全帖
m******t
发帖数: 2416
18
Oracle has only provided support for CLOB/BLOB through
their proprietary classes. You have to cast your
Statement and RecordSet classes downward to the Oracle
implementation, and call some non-JDBC methods on those
classes.
Go to jGuru, search for Oracle and CLOB.
a*****i
发帖数: 1316
19
中国外汇交易中心携手ICAP 构建下一代交易系统
全球著名银行间交易经纪商、伦敦交易所上市公司毅联汇业(ICAP)今日刚刚宣布,中
国外汇交易中心(CFETS)已选定其为中国大陆固定收益及电子外汇执行服务提供核心技
术。该项技术将通过ICAP旗下电子外汇及固定收益交易平台EBS BrokerTec实现。
中国外汇交易中心筹划下一代交易系统(NGTS)多年,此次合作,ICAP将成为外汇交易
中心新一代交易系统的核心组成部分。应用EBS Market、 EBS Direct和BrokerTec Dir
ect的优势技术,新的交易系统将提高外汇交易中心提供中央限价订单(CLOB)的能力以
及公开外汇即期、远期、掉期交易模式,在在岸人民币市场通过本土化的EBS BrokerTe
c图形用户界面(GUI),形成一个公开的现金债券交易模型。
自建立上海合资公司CFETS ICAP,提供在岸离岸银行间外汇、货币市场、债券以及衍生
品市场经纪和信息相关服务以来,中国外汇交易中心与ICAP已成功合作超过9年。而再次
合作,此次估值6500万美元为期三年的订单,将继续见证ICAP进军中国的过程,促成IC
... 阅读全帖
l******u
发帖数: 362
20
谢谢
有回去看了一眼,你说得对,我又一次搞晕了,应该反的garnier得,下面写着
garnier
amount spent to this award 14.97
amount need to this award 0.03
但是出的ECB写着for beauty,我就以为是beauty club 的了
又算了一下那个beauty clob确实应该还没累计到呢
看来忙的时候脑子比较乱,不适合搞deal
B*****g
发帖数: 34098
21
来自主题: BuildingWeb版 - 动态生成pdf一问
google "blob", "clob"
B*****n
发帖数: 135
22
来自主题: Database版 - 求教长文本录入
1. use sql loader and put the file name in the control file.
or
2. use dbms_lob.loadfromfile to load a text file into say a
clob.
s*k
发帖数: 144
23
来自主题: Database版 - 非高人莫答
你用的Oracle版本VARCHAR2最大长度为2000B,
建议换用其他类型如LONG, CLOB或拆分你的
数据成多个Column,
也可升级Oracle至最新版(但VarChar2也只能
支持到4000B)
S**a
发帖数: 120
24
来自主题: Database版 - Oracle 8i export and import ?
I'm using Oracle 8.1.6 on NT 4 server.
I EXP a table which has a CLOB field from one database and
try to IMP it to another database, but failed. the error
messages showes the tablespace of the table is not existed
in the new database, I already set IGNORE = Yes, but still
this problem.
Some suggestions ?
Thanks.
h****r
发帖数: 2056
25
I found maybe use the prepare/bind/exec is a good way to
handle the
CLOB, but I meet some problem when use it. Do you ever have
expreience
and can point out what is wrong for my code?
I debugged it, the problem is from the SQLExecute, so the
SQLBindParameter
may have problem. But I really don't know where I can find
an example
to use them.
void updateClob(const char* lobString)
{
SQLRETURN lRetVal;
SQLHSTMT lSqlHstmt;
SQLINTEGER ind = SQL_DATA_AT_EXEC;
w*****h
发帖数: 139
26
来自主题: Database版 - Help need on writing data to Oracle CLOB!
I have experience to insert BLOB into Oracle with JDBC. We have to use
Oracle's own JDBC classes to do it.
m******n
发帖数: 497
27
if you use CLOB type in your table it's 4G
v********e
发帖数: 1985
28
来自主题: Database版 - dbi informix text insertions question
How do i insert text(CLOB) into informix database using perl dbi:informix? I
have no trouble using mysql, but i am required to migrate to informix now.
many thanks in advance
ice
h****r
发帖数: 2056
29
来自主题: Database版 - How to read CLOB by sqlplus?
rt. Thanks a lot.
b**********n
发帖数: 3
30
来自主题: Database版 - [转载] what's wrong with this PL/SQL
【 以下文字转载自 Programming 讨论区,原文如下 】
发信人: blackjackwon (BlackJack), 信区: Programming
标 题: what's wrong with this PL/SQL
发信站: The unknown SPACE (Thu Sep 19 16:15:05 2002) WWW-POST
I wrote a simple PL/SQL to reading CLOB. However, I got an error saying:
"
select SEQUENCE into locator_var
*
ERROR at line 9:
ORA-06550: line 11, column 22:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 9, column 1:
PL/SQL: SQL Statement ignored
"
My PL/SQL looks like this:
decla
c*****d
发帖数: 6045
31
database可以用text, clob来储存文本,查询速度肯定比文件系统快

位置.
B*****g
发帖数: 34098
32
来自主题: Database版 - Oracle / DB2 问题
I did not see any problem in oracle to use CLOB as long as not store in
table.
c**t
发帖数: 2744
33
Some row are extremely long (>32K), which is over block limit.. my solution
is to use clob for some field.

100
B*****g
发帖数: 34098
34
来自主题: Database版 - oracle的同志都来了,问个问题
table里有lob,update(非lob column)performance有多大影响?考虑clob可以
inline。
v*****r
发帖数: 1119
35
来自主题: Database版 - oracle的同志都来了,问个问题
$0.02 :->
读入 rows with inline lob, it is roughly like reading in varchar2(4000)
colomn for inline lob column; 读入 rows with outline lob, I/O is more
efficient than other inline clob rows as more outline lob rows can be read
into buffer.
总之,如果是update 非lob columns 的话, lob column 对 performance 影响很小,
很小。
s********e
发帖数: 893
36
来自主题: Database版 - Oracle long数据类型 行转列的问题
Oracle里一个数据类型是Long。Long类型可以用来存储超过4000字符的数据,尽管最近
几个版本已经被Blob Clob取代了,但是一些老数据库还在用着。现在的问题是这样的:
ID Comm_Date Comm
1 10/01/2015 testing comment 1
1 10/07/2015 testing comment 2
1 10/08/2015 testing comment 3
1 09/28/2015 testing comment 4
2 10/20/2015 Another comment 1
2 10/08/2015 Another comment 2
2 09/30/2015 Another comment 3
....
这个comm是Long类型。 现在想把每个ID的最近两个日期的Comment找出来,而且放到两
个column。就是最后想显示成这样:
1 10/08/2015 testing comment 3 10/07/2015 testing comment 2
2 10/20/2015 ... 阅读全帖
m******t
发帖数: 2416
37

Which version of the jdbc driver are you using? Did you try setClob()?
xt
发帖数: 17532
38

This is probably the problem of Oracle JDBC itself. As I remember
if they string is too long (sth like more than 2 or 4k), you may
not use setString directly with Oracle thin driver.
This is one of the reasons why Oracle JDBC sucks
w******t
发帖数: 1422
39

yea, it sucks. let me add 2nd reason,
some API methods were never "really" implemented.
xt
发帖数: 17532
40

if
Oracle JDBC driver, especially the Oracle:thin driver, is the worst I know
amoungst
major DBMS's. It has many many problems. For example, if you define a CHAR[40]
field
in your schema, then set it to "hello". It works fine if you do a direct SQL
search
for WHERE field='hello'. However if you use JDBC with the very same string,
you will
never get the record back. You have to use "hello" padded with 34 spaces to
get the
record back. Talking about consistency! IMHO, Sybase has the best SQL
comp
xt
发帖数: 17532
41

Yes, this is the way we do the job. MS SQL Server has some other
JDBC problems such as stored procedure support etc. The SQL itself
is very similar to Sybase because MS bought their source code.
m**c
发帖数: 90
42

We are using Opt2000 JDBC driver for MS SQL, it is very good.
(should
method
We
xt
发帖数: 17532
43
来自主题: Java版 - java数据库读取错误,请教

Let me explain what CHAR(32) means. CHAR(32) means a fixed length string
field as opposed what is defined by VARCHAR or CLOB etc. However, CHAR(32)
does not mean you have to make your value 32 long, but you cannot go beyond
32. In case you do not have 32 characters, DBMS will append white space
to it - which is what Oracle is doing as well. However, that does not mean
that when you retrieve the data, it should give you the white space it adds.
Obviously MS, IBM, Sybase and even Oracle SQL Plus
m******t
发帖数: 2416
44

My experience with blob/clob wasn't that bad either.
Since you are looking for java databases, I assume you want to embed one in
your application. If that's correct, do you actually care that much about
the performance difference between this and blob?
(bah, I kept mis-typing "blob" as "blog")
B*****g
发帖数: 34098
45
为啥扔blob不扔clob?
啥叫直接看DB方便?
g*****g
发帖数: 34805
46
傻逼你又不懂了吧,DB是要存url, 但是url长度可以几千,有的网站可以来一堆url前
面都一样,最后一个参数不一样。
数据库用VARCHAR都存不了,长度不够。用CLOB比慢死你。
所以上个hash, 位数弄长一点,就算你是google search, 也有个几个collide到头了,
然后一比实际url就知道。
你丫整一外行,没经验的东西,就别误导了。
g*****g
发帖数: 34805
47
傻逼我哪里说不用存url, 我说的是varchar存不下,得用clob. 你丫非说varchar存得
下被打脸不是?
g*****g
发帖数: 34805
48
尼玛这傻逼连我说的话,也能纂改,都什么人呀。就为了自己一点破脸,一点人格都不
要了。
信人: goodbug (好虫), 信区: Programming
标 题: Re: tinyurl 是怎么做到同一个long url两次得到相同的short ur
发信站: BBS 未名空间站 (Wed Feb 12 00:50:16 2014, 美东)
傻逼你又不懂了吧,DB是要存url, 但是url长度可以几千,有的网站可以来一堆url前
面都一样,最后一个参数不一样。
数据库用VARCHAR都存不了,长度不够。用CLOB比慢死你。
q*j
发帖数: 156
49
来自主题: XML版 - XML到底有什么好处?
some file, like a series of book, it's hard to store in database directly,
and XML is good for this kind of semi-structured data.
for example, a query like find all the second section of second chapter
of the book written by far, this query is not doable if the entire book
is just stored as a CLOB.
p****y
发帖数: 23737
50
来自主题: _Vegetarianism版 - 香港环保名人周兆祥
http://www.vegsochk.org/
上星期六下午,Club O的电话接二连叁收到本地传媒要求回应关於素食是否健康的问题
,阿祥马上知道:又是那些荒谬无聊的甚麽研究出笼。不出所料,每隔一年半载,我们
的记者、编辑、监製又总是热闹一番,反覆炒作同个老话题:吃素缺乏维他命B12。
翌日本地所有中文报章港闻版无一放过:〈食素缺蛋牛奶易患心脏病〉(《明报》、〈
戒荤茹素易患冠心病中风〉(《文汇报》、〈素食乏维生素B12易中风〉(《商报》)
,最誇张的是〈35万茹素者易患中风冠心病〉(《大公报》)……。
原来是中大文大学内科及药物治疗学系发表一份报告,指出刚完成的一项研究发现:本
地素食者血管弹性较差、血管内中膜较厚、体内维他命B12较少,所以易患心脏病中风
等,建议素食者要吃维他命B12补充剂。为了加强说服力,该系顾问胡医生还在发布会
上说:「星云法师都要通波仔啦!」
阿祥愚见……
正如其他类似的不少调查研究一样,这次「惊人发现」的研究在概念、方法学、态度、
结论方面错漏百出,疑点重重(下期7月号的《茹素》将有详尽的分析与介绍,敬请留
意;有兴趣凑热闹的朋友及会员可先访[Clob ... 阅读全帖
1 (共1页)