Using Clob in hibernate+oracle10g+spring
I hava a problem on ClobStringType.
I set the type of Clob in XXXPO is String.and also is "org.springframework.orm.hibernate.support.ClobStringType" in xxxPO.hbm.xml.In applicationContext.xml ,decalaring it with Bean:
<bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor"/>
<bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler">
<property name="nativeJdbcExtractor"><ref local="nativeJdbcExtractor"/></property>
</bean>
In Class LocalSessionFactoryBean,it's "<property name="lobHandler"><ref bean="oracleLobHandler"/></property>"
But the problem has existed,and I got the warning:
java.lang.IllegalStateException: ClobStringType requires active transaction synchronization.
Who can tell me should I how to solve it ,and I leaked which step?
Beg your answer. Please quick,my problem is waitting you,Thanks.
shienna17 wrote:
javax.servlet.ServletException: java.lang.ClassCastException: [B cannot be cast to java.sql.Blob
That means you're trying to cast a byte array to Blob.
Similar Messages
-
Opening a ref cursor using CLOB variable
Is there any way to open a ref cusor using CLOB variable.
When I am opening on CLOB variable , I am getting an error like 'Missing Expression'
Please help meFor 10g...
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_large_sql CLOB;
3 v_num NUMBER := 0;
4 v_upperbound NUMBER;
5 v_sql DBMS_SQL.VARCHAR2S;
6 v_cur INTEGER;
7 v_ret NUMBER;
8 begin
9 -- Build a very large SQL statement in the CLOB
10 LOOP
11 IF v_num = 0 THEN
12 v_large_sql := 'CREATE VIEW vw_tmp AS SELECT ''The number of this row is : '||to_char(v_num,'fm0999999')||''' as col1 FROM DUAL';
13 ELSE
14 v_large_sql := v_large_sql || ' UNION ALL SELECT ''The number of this row is : '||to_char(v_num,'fm0999999')||''' as col1 FROM DUAL';
15 END IF;
16 v_num := v_num + 1;
17 EXIT WHEN DBMS_LOB.GETLENGTH(v_large_sql) > 40000 OR v_num > 800;
18 END LOOP;
19 DBMS_OUTPUT.PUT_LINE('Length:'||DBMS_LOB.GETLENGTH(v_large_sql));
20 DBMS_OUTPUT.PUT_LINE('Num:'||v_num);
21 --
22 -- Now split that large SQL statement into chunks of 256 characters and put in VARCHAR2S array
23 v_upperbound := CEIL(DBMS_LOB.GETLENGTH(v_large_sql)/256);
24 FOR i IN 1..v_upperbound
25 LOOP
26 v_sql(i) := DBMS_LOB.SUBSTR(v_large_sql
27 ,256 -- amount
28 ,((i-1)*256)+1 -- offset
29 );
30 END LOOP;
31 --
32 -- Now parse and execute the SQL statement
33 v_cur := DBMS_SQL.OPEN_CURSOR;
34 DBMS_SQL.PARSE(v_cur, v_sql, 1, v_upperbound, FALSE, DBMS_SQL.NATIVE);
35 v_ret := DBMS_SQL.EXECUTE(v_cur);
36 DBMS_OUTPUT.PUT_LINE('View Created');
37* end;
SQL> /
Length:40015
Num:548
View Created
PL/SQL procedure successfully completed.
SQL> select count(*) from vw_tmp;
COUNT(*)
548
SQL> select * from vw_tmp where rownum <= 10;
COL1
The number of this row is : 0000000
The number of this row is : 0000001
The number of this row is : 0000002
The number of this row is : 0000003
The number of this row is : 0000004
The number of this row is : 0000005
The number of this row is : 0000006
The number of this row is : 0000007
The number of this row is : 0000008
The number of this row is : 0000009
10 rows selected.
SQL> -
Using Clob with TopLink 9.0.4.5 and Oracle 10g RAC
I am trying to store an XML file in a Clob type field of a DB table using TopLink 9.0.4.5 and Oracle 10g RAC and need some guidance about how to do it. I got some directions to start it with the Tip "How-To: Map Large Objects (LOBs) to Oracle Databases with OracleAS TopLink" but still need some more helps.
When using the Oracle JDBC OCI driver, the tip gives the code block for a Clob field:
DirectToField scriptMapping = new DirectToField();
scriptMapping.setAttributeName("script");
scriptMapping.setFieldName("IMAGE.SCRIPT");
descriptor.addMapping(scriptMapping);
As I understand, TopLink creates instances of the Descriptor class at run time for each of the descriptor files and stores them in a database session, where is the proper place (in SessionEvent of TopLinkSessionEventHandler?) for me to get a reference to such an instance of my Descriptor class in Java code so that I can add the above mentioned additional Mapping? Are the above String values of "script" and "IMAGE.SCRIPT" predefined in TopLink API? Can I accomplish the same thing just using the TopLink Workbench tool instead? If yes, please advise the detailed steps to do so.
The tip also states to call the following code in case of using Clob:
DatabaseLogin login = session.getLogin();
login.useStringBinding();
Should the above 2 lines of code be called after the following lines of code?
SessionManager sessionManager = SessionManager.getManager();
Server serverSession = (Server)sessionManager.getSession("MY_SESSION_NAME");
Besides the above extra coding for the Session and Descriptor Mapping, is there any special handling in between Data model and DB table mapping? Can I map a Java String type to a DB Clob field using the Direct-to-field mapping?
Appreciate any help.Never mind ....... I had already figured it out .....
-
Problem While using CLOB/BLOB datatype:
We have created a directory in E drive and created a directory alias in oracle.
to read the data from CLOB data type we have to write a PL/SQL code.
But i am getting an errorin the block .ie non existent directory or file....
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 475
ORA-06512: at line 8
but the directory and file is there with all permissions.
nullHi,
Your buffer size should be the clob size.
char[] buffer = new char[c_lob.getBufferSize()];
Also, set the value for i as -1.
You could see the sample on OTN for help:
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/LOBSample/Readme.html
Thanks,
Rashmi -
EBS - 12 XMLP (5.6.3) cannot use CLOBS ?????
Hello: I am being told by Metalink Support the following:
" Bi Publisher 5.6.3 (10.1.3.2.0) does not have native support for CLOB.
This comes in BI Publisher Enterprise 10.1.3.3.0.
There are no plans at this time to upgrade EBS to higher versions of BI Publishe
r code."
So for EBS - 12, I cannot use CLOBS ?????
How am I supposed to write reports that use large CLOBS ?
Also, there was some mention about leaving out DataStructures in templates for CLOBS ?
Anyone with experience in this situation, please help ...
YeshHi Yesh,
There is a BI (XML) Publisher Desktop for 5.6.3 that you can use, and you can use the latest versions of the desktop to build your layouts, but be aware the later versions may have more supported features not present in 5.6.3. I use 10.1.3.something for developing EBS reports and have standalone BIP Server on my desktop for checking features against.
Data Templates are not the only way to register BIP reports in the EBS Concurrent Manager.
You can use **any** program as long as it does actually output XML and you have set the "Output" to XML.
The choice is up to you as to how you extract your data to XML - whatever works!
I'm not sure what all your CLOB issues are, but creating the XML that have CLOBS shouldn't cause issues (unless you are forced by something to use dataTemplates).
Gareth -
HI All
I have AQ table and queue of object type. The object contains only one CLOB type field.
I tried to enqueue some message using OCI functions but I got error message:
OCI Error <25215> - ORA-25215: user_data type and queue type do not match.
I'm using struct defined as below:
struct message
OCILobLocator * data;
Does anyone know how to use CLOB object with OCI functions or maybe there is better type to enqueue hude messages??
Thank you.U just have to define a rule when creating a subscriber to your queue.
-
Using CLOB data type - Pros and Cons
Dear Gurus,
We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
Some of the concerns brought up during discussion were:
- having to store CLOBs in separate tablespace;
- applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;
- applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;
- cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;
- to manipulate CLOBs you need PL/SQL anonymous block or procedure;
- bind variables cannot be assigned CLOB value;
- dynamic SQL cannot use CLOBs;
- temp tables don't work very well with CLOBs;
- fuzzy logic search on CLOBs is ineffective;
- not all ODBC drivers support Oracle CLOBs
- UNION, MINUS, INTERSECT don't work with CLOBs
I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?848428 wrote:
Dear Gurus,
We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
Some of the concerns brought up during discussion were:
- having to store CLOBs in separate tablespace;They can be stored inline too. Depends on requirements.
- applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;Toad is a developer tool so that shouldn't matter. What should matter is how you display the data to end users etc. but that will depend on the interface. Some can handle CLOBs and others not. Again, it depends on the requirements.
- applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;Why would they struggle? 18,000 characters is only around 18k in file size, that's not that big to a web page.
- cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;Who's caching them in memory? What are you planning on doing with these CLOBs? There's no real reason they should impact performance any more than anything else, but it depends on your requirements as to how you plan to use them.
- to manipulate CLOBs you need PL/SQL anonymous block or procedure;You can manipulate CLOBs in SQL too, using the DBMS_LOB package.
- bind variables cannot be assigned CLOB value;Are you sure?
- dynamic SQL cannot use CLOBs;Yes it can. 11g supports CLOBs for EXECUTE IMMEDIATE statements and pre 11g you can use the DBMS_SQL package with CLOB's split into a VARCHAR2S structure.
- temp tables don't work very well with CLOBs;What do you mean "don't work well"?
- fuzzy logic search on CLOBs is ineffective;Seems like you're pulling information from various sources without context. Again, it depends on your requirements as to how you are going to use the CLOB's
- not all ODBC drivers support Oracle CLOBs not all, but there are some. Again, it depends what you want to achieve.
- UNION, MINUS, INTERSECT don't work with CLOBsTrue.
I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?You may have more hassle if you "need" to accept more than 4000 characters and you are splitting it into seperate columns or rows, when a CLOB would do it easily.
It seems as though you are trying to find all the negative aspects of CLOBs and ignoring all the positive aspects, and also ignoring the negative aspects of not using CLOB's.
Without context you're assumptions are just that, assumptions, so nobody can tell you if it will be right or wrong to use them. CLOB's do have their uses, just as XMLTYPE's have their uses etc. If you're using them for the right reasons then great, but if you're ignoring them for the wrong reasons then you'll suffer. -
Using WebLogic JMS Wrappers with Spring
Hi,
I was just wondering if anyone used WebLogic JMS wrappers with Spring?
I am using WebLogic configured to have Sonic as my Foreign JNDI Provider. Weblogic provide me with specific entries on the admin console to set information such as the JNDI name of the Sonic Connection Factory. If I specify this JNDI name in the Spring config, and call getConnection() then I will get back a new connection each time.
I don't want this, I want to cache the connection (as connections are expensive in Sonic). This is where the WebLogic JMS wrappers come in, they can handle the pooling for me but the only way I can see to use them is via a resource-ref. It is possible for Spring to get a handle onto these wrappers or should I use Spring's own pooling mechanism instead?
P.S. I've also asked this question on the Spring forum
Thanks for any help
MandyMaybe you have already tried the following:
<beans xmlns:jee="http://www.springframework.org/schema/jee" ... >
<jee:jndi-lookup id="connectionFactory" jndi-name="jms.ConnectionFactory">
<jee:environment>
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://localhost:7001
</jee:environment>
</jee:jndi-lookup>
</beans>
an alternative is to use the JNDI template
<beans ... >
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
<prop key="java.naming.provider.url">t3://localhost:7001</prop>
</props>
</property>
</bean>
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="jndiName"><value>jms.ConnectionFactory</value></property>
</bean>
</beans> -
I just created a new database using dbca with General Purpose as the template, as I've done before. All went well until I tried to create tables that used clob or blob datatypes. I kept getting the error "ORA-03001: unimplemented feature".
What happened? Was the database created improperly? Is there a way to correct this without recreating the database?
ThanksI just created a new database using dbca with General
Purpose as the template, as I've done before. All
went well until I tried to create tables that used
clob or blob datatypes. I kept getting the error
"ORA-03001: unimplemented feature".
I have the same problem but only if I assign a tablespace to the table but not if i leave it to the default tablespace. -
I want to use an XMLCollection in a Spring bean
From within a mxml I make a HttpSession call that generates
an XMLCollection (e4x). I then use the XML with in the mxml. I also
want to use the XML in an Spring bean. Any idea how I can id the
XML in the HttpSession?
Thanks for the helpHave a look at this Flex Cookbook Article:
http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postI d=3401 -
Hi,
Can some one help.
I am getting string more than 32767 char so I want to use CLOB but I am unable to use in ref Cursor.
CREATE OR REPLACE PROCEDURE PM.PROC_CURSOR_BTDCS (P_QUERY IN varchar2, P_batchid out Number) AS
P VARCHAR2(32767);
P_CURSOR_QUERY SYS_REFCURSOR;
X_JOBID varchar2(30);
X_BATCHID VARCHAR2(1000);
X_CREF VARCHAR2(10000);
X_CLIENTREF VARCHAR2(10000);
X_CLIENTID NUMBER;
X_USERID NUMBER;
X_RDATE varchar2(40);
X_DDATE varchar2(40);
X_STAGE NUMBER;
X_DIFF NUMBER;
X_CLIENTDUEDATE varchar2(40);
X_ASSETID NUMBER;
X_MODEID NUMBER;
p_o_error VARCHAR2(100);
p_o_status NUMBER;
BEGIN
P := 'SELECT DISTINCT JOBID,CLID,USERID,STAGE,
GET_CSV_DATA(CURSOR (SELECT CREF FROM ('|| P_QUERY ||') WHERE jobid =A.JOBID AND CLID=A.CLID AND USERID=A.USERID AND RDATE=A.RDATE AND DDATE=A.DDATE AND STAGE=A.STAGE AND ASSETID=A.ASSETID AND CLDATE=A.CLDATE AND DIFF=A.DIFF)) C_CREF,
GET_CSV_DATA(CURSOR (SELECT BATCHID FROM ('|| P_QUERY ||') WHERE jobid =A.JOBID AND CLID=A.CLID AND USERID=A.USERID AND RDATE=A.RDATE AND DDATE=A.DDATE AND STAGE=A.STAGE AND ASSETID=A.ASSETID AND CLDATE=A.CLDATE AND DIFF=A.DIFF)) C_BATCH,
GET_CSV_DATA(CURSOR (SELECT Crefname FROM ('|| P_QUERY ||') WHERE jobid =A.JOBID AND CLID=A.CLID AND USERID=A.USERID AND RDATE=A.RDATE AND DDATE=A.DDATE AND STAGE=A.STAGE AND ASSETID=A.ASSETID AND CLDATE=A.CLDATE AND DIFF=A.DIFF)) C_CLIENTREF
,DIFF,cldate,ASSETID
,RDATE,DDATE,MODEID
FROM('||P_QUERY||') A';
--INSERT INTO FROG VALUES(P,sysdate);
OPEN P_CURSOR_QUERY FOR P;
LOOP
FETCH P_CURSOR_QUERY INTO X_JOBID
,X_CLIENTID,X_USERID,X_STAGE,
X_CREF,X_BATCHID,X_CLIENTREF,X_DIFF,
X_CLIENTDUEDATE,
X_assetid,X_RDATE,X_DDATE,X_MODEID;
EXIT WHEN P_CURSOR_QUERY%NOTFOUND;
-- INSERT INTO FROG VALUES (X_CREF);
Proc_batchchangestage_upd (X_JOBID,X_BATCHID,X_CREF,X_CLIENTREF,X_userid,X_clientid,X_RDATE,
X_DDATE,
X_stage,
X_CLIENTDUEDATE,
X_diff,
X_assetid,X_MODEID,p_batchid,
p_o_error,
p_o_status);
END LOOP;
CLOSE P_CURSOR_QUERY;
COMMIT;
END;It would be helpful to indicate the error you're getting and the line where you're getting the error.
I will assume that your goal is to construct a SQL query > 32k, store that query in p, and open a cursor using p. In order to do that, you'd have to use the DBMS_SQL package, which is going to complicate your life rather significantly.
That said, it's far from obvious to my why the SQL statement needs to exceed 32k. At a minimum, concatentaing P_QUERY three times would seem unnecessary. If the text of P_QUERY exceeds 10,000 characters, I would really tend to suspect that you've done something wrong there and would benefit from simplifying the query or at least using a couple views.
Justin -
How to use clob or blob data type in OWB
how to use clob or blob data type in OWB?
if OWB not surport these data type,how can i extract the large data type from data sourceThe same question was asked just two days ago No Data Found: ORA-22992
Nikolai Rochnik -
When I use CLOB like
CREATE OR REPLACE PROCEDURE Example_1b(retData out clob) IS
src_lob cLOB;
BEGIN
SELECT b_lob INTO src_lob
FROM lob_table
DBMS_LOB.APPEND(dest_lob, src_lob);
COMMIT;
EXCEPTION
WHEN some_exception
THEN handle_exception;
END;
There are thousand records in lob_table.When I run the procedure,It's very very slowwer !
How to improve it?I assume there are some lines missing here.
>
1 CREATE OR REPLACE PROCEDURE Example_1b(retData out clob) IS
2 src_lob cLOB;
3 BEGIN
4 SELECT b_lob INTO src_lob
5 FROM lob_table
6 DBMS_LOB.APPEND(dest_lob, src_lob);
7 COMMIT;
8 EXCEPTION
9 WHEN some_exception
10 THEN handle_exception;
11 END;
[unquote]
Is there a where clause missing after line 5 or is it your intent to select your whole clob table? If it is, then you should use a curser like so:
>
1 CREATE OR REPLACE PROCEDURE Example_1b(retData out clob) IS
2 CURSOR c1 is SELECT b_lob
3 FROM lob_table;
4
5 src_lob cLOB;
6 BEGIN
7 for src_lob in c1 loop
6 DBMS_LOB.APPEND(dest_lob, src_lob);
7 end loop;
8 EXCEPTION
9 WHEN some_exception
10 THEN handle_exception;
11 END;
[unquote]
Please note, I removed the commit at line 7 as it was unecessary in your procedure (you showed no inserts, updates, or deletes). -
How to store a large document in Oracle9i using CLOB!?
Hi all,
I want to store a large document(about 10mb) in Oracle9i using SQL*PLUS. How to store it using CLOB in Oracle9i!?
What the necessary steps to perform!?
ThanksJust use the report's CUID or ID for the iDocID parameter, and give all necessary users the appropriate rights to the inbox where the report is located.
repoType is a legacy parameter, this will have no effect.
http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_url_reporting_opendocument_en.pdf -
How to use Ejb with Hibernate in netbeans
hello everybody
i am developing a project using ejb and hibernate as a persistance provider. i need some idea how to develop a web application in netbeans. I went through a example in netbeans but it's not helping me.If any body can give me some idea
many thanks
sriWell, I've never used a JProgressBar before, so I'm
not sure. If I add it to the frame, can I call it
whenever I need to use it like when I click the
JMenuItem do I just call it?Questions like these are better answered by the tutorials:
http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
Maybe you are looking for
-
CRS install fails Oracle home incompatibility checks ( 10G )
Hi, I'm trying to install RAC for 10.2.0 . The first step is to install cluster Ready Services ( On red hat linux ) . When it does the product specific prequisite checks, it fails on "Checking for Oracle home incompatibilities". I get the error " Ora
-
Need a Script to Audit Firmware version of HP components​.
Hi Team, I am new to this portal, I am not sure if i have selected the correct board for this issue. If not please redirect thie thread to the correct team or guide me the link to the HP Blade system portal. My issue: We have 285 HP Servers, Where al
-
I need to ensure that a unique key value is stored in a column. Values must be persistent across DB restores. A Sequence is fine to initially populate the column, but I must also ensure a key is applied to records inserted later (by third-party code
-
Dear All, There is no tax on purchase. Whatever tax mentioned in the invoice are capitalized/booked under expenses. Should i use FI Tax procedure for it. The illustrative pricing is as follows: Please suggest an approach for it Price of item
-
I have a N85 and use call divert a great deal. Is there a way of moving call divert to the main menu screen of the N85? Thanks Solved! Go to Solution.