由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 使用Clob的setString方法出现如下错误
相关主题
java在美国到底怎样?Re: [转载] 急!在线等---从Servlet调用AXIS的Web Serv
请问个从windows通过jdbc连server的问题A question on application server
java数据库读取错误,请教oracle/sun deal
oracle help: pass array to oracle SPJava Object 一定在 Heap 里吗
Re: 急问!如何通过jdbc向oracle中加入大于4000个字符的数据?请教framework
Help! About WeblogicRe: Need help with EJB
怎么没人整一JAVA VISUAL STUDIO MS SQL Server JDBC Driver Problem
BEA WEBLOGIC WORKSHOPWeblogic 8.1又一个问题---应该是有关JDBC的
相关话题的讨论汇总
话题: clob话题: oracle话题: jdbc话题: setstring话题: strtemp
进入Java版参与讨论
1 (共1页)
t********k
发帖数: 808
1
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
m******t
发帖数: 2416
2

Which version of the jdbc driver are you using? Did you try setClob()?

【在 t********k 的大作中提到】
: Clob clob = null;
: String strTemp;
: ... //给strTemp赋了一文章的内容
: clob.setString(1,strTemp)
: 执行到上面一句是出现如下错误
: 用的系统是Oracle9i
: 看了JDK,setString在1.4已经支持了
: 而我用的Bea Weblogic 8.1
: 用的是JDK1.4.1
: 为什么?

m******t
发帖数: 2416
3

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******t 的大作中提到】
:
: Which version of the jdbc driver are you using? Did you try setClob()?

t********k
发帖数: 808
4
是先处理clob,用setString把String变量的值放到
clob里
然后用setClob
因为把所一文章里的文字放到clob字段内

【在 m******t 的大作中提到】
:
: 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...

t********k
发帖数: 808
5
实际上我曾试过oralce.sql.CLOB
但一用这,我连从数据库中取clob字段的值都出错
就是下面语句
oralce.sql.CLOB clob = (oracle.sql.CLOB)rs.getClob(1)
一执行到这
后面的语句都不执行了
没抛出异常
却去执行finally里的语句了
真是不懂
用下面的没事
Clob clob = rs.getClob(1)
另外我的同事用oracle.sql.CLOB没事
我的语句和他的没什么两样
Faint死我了

【在 m******t 的大作中提到】
:
: 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...

xt
发帖数: 17532
6

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

【在 m******t 的大作中提到】
:
: 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...

w******t
发帖数: 1422
7

yea, it sucks. let me add 2nd reason,
some API methods were never "really" implemented.

【在 xt 的大作中提到】
:
: 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

m******t
发帖数: 2416
8

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.

【在 t********k 的大作中提到】
: 是先处理clob,用setString把String变量的值放到
: clob里
: 然后用setClob
: 因为把所一文章里的文字放到clob字段内

xt
发帖数: 17532
9

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

【在 m******t 的大作中提到】
:
: 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.

m**c
发帖数: 90
10

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

【在 t********k 的大作中提到】
: 实际上我曾试过oralce.sql.CLOB
: 但一用这,我连从数据库中取clob字段的值都出错
: 就是下面语句
: oralce.sql.CLOB clob = (oracle.sql.CLOB)rs.getClob(1)
: 一执行到这
: 后面的语句都不执行了
: 没抛出异常
: 却去执行finally里的语句了
: 真是不懂
: 用下面的没事

xt
发帖数: 17532
11

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 的大作中提到】
:
: 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

m**c
发帖数: 90
12

We are using Opt2000 JDBC driver for MS SQL, it is very good.
(should
method
We

【在 xt 的大作中提到】
:
: 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.

1 (共1页)
进入Java版参与讨论
相关主题
Weblogic 8.1又一个问题---应该是有关JDBC的Re: 急问!如何通过jdbc向oracle中加入大于4000个字符的数据?
土人问个J2EE的弱问题 *_<Help! About Weblogic
JAVA J2EE 工作的技能要求怎么没人整一JAVA VISUAL STUDIO
DC hot start-up 招 JAVA engineer (sponsor h1b, green-card) BEA WEBLOGIC WORKSHOP
java在美国到底怎样?Re: [转载] 急!在线等---从Servlet调用AXIS的Web Serv
请问个从windows通过jdbc连server的问题A question on application server
java数据库读取错误,请教oracle/sun deal
oracle help: pass array to oracle SPJava Object 一定在 Heap 里吗
相关话题的讨论汇总
话题: clob话题: oracle话题: jdbc话题: setstring话题: strtemp