Oracle XMLType and clobs
Hi,
I've been struggling for days trying to figure out how to populate an XMLType
field in Oracle 9i. I'm using the OracleThinDriver, WL 7.0, weblogic oracle extensions
and a WL connection pool but to no avail.
Has anyone done this? Is it possible? I keep getting an invalid LOB when I do
a select on the XMLType field and cast it to a OracleThinClob type and attempt
to write to it.
Any help is much appreciated.
Thx.
Rachel
We do not support XMLType oracle extension in 7.0. That feature is available from next
major release(8.0?).
Mitesh
Rachel Hall wrote:
Hi,
I've been struggling for days trying to figure out how to populate an XMLType
field in Oracle 9i. I'm using the OracleThinDriver, WL 7.0, weblogic oracle extensions
and a WL connection pool but to no avail.
Has anyone done this? Is it possible? I keep getting an invalid LOB when I do
a select on the XMLType field and cast it to a OracleThinClob type and attempt
to write to it.
Any help is much appreciated.
Thx.
Rachel
Similar Messages
-
Help required in handling of Oracle BLOB and CLOB in OC4J
Hi,
I am in a process of porting my application from Weblogic 6 to OC4J.
I have problem while handling CLob and Blob's in oracle. Weblogic has
classes defined to do the same. (weblogic.jdbc.common.OracleClob)
Does any one know how I can achieve this.
Thanks in advance.
Regards,
MoinWe have an application running on OC4J accessing an Oracle 8.1.7 db, and have no problems using BLOBs and CLOBs. It is explained quite clearly in the Oracle documentation.
If you require further assistance let me know :-) -
For full document retrieval and inserts is there a performance difference between declaring a XMLType or a simple CLOB database column type in table.
Thanks in advance.I have a related question:
Is there any difference between using the XMLTYPE constructor function and using XMLTYPE.CREATEXML to convert a temporary CLOB to XMLTYPE?
I have the following in a PL/SQL function (simplified):
FUNCTION get_geocode_xml( p_geocodes IN CLOB) RETURN XMLTYPE IS
r_geocodes XMLTYPE;
BEGIN
r_geocodes := XMLTYPE.CREATEXML(p_geocodes);
RETURN r_geocodes;
END;Is this the same as using the constructor as in
r_geocodes := XMLTYPE(p_geocodes);
It seems to work either way, but I've only extensively tested the first method. -
Oracle Streams and CLOB column
Hi there,
We are using "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit". My question is "Does Oracle Streams captures, propagates (source capture method) and applies CLOB column changes?"
If yes, is this default behavior? Can we tell Streams to exclude the CLOB column from the whole (capture-propage-apply) process?
Thanks in advance!You can exclude columns via a rule (dbms_streams_adm.delete_column).
CLOBs are captured.
http://download.oracle.com/docs/cd/E11882_01/server.112/e17069/strms_capture.htm#i1006263 -
Accessing XMLType and CLOB from Enterprise Java Beans
When trying to create a temporary CLOB within the application server the following exception
occurs (connection from Jndi):
Oracle9iAS (9.0.2.0.0) Containers for J2EE initialized
AccessEJBBean.meld: ex=java.lang.NullPointerException java.lang.NullPointerException
at oracle.sql.LobPlsqlUtil.plsql_createTemporaryLob(LobPlsqlUtil.java:1352)
at oracle.jdbc.dbaccess.DBAccess.createTemporaryLob(DBAccess.java:997)
at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:240)
at oracle.sql.CLOB.createTemporary(CLOB.java:527)
at com.access.impl.AccessEJBBean.meld(AccessEJBBean.java:67)
(email: [email protected] )When trying to create a temporary CLOB within the application server the following exception
occurs (connection from Jndi):
Oracle9iAS (9.0.2.0.0) Containers for J2EE initialized
AccessEJBBean.meld: ex=java.lang.NullPointerException java.lang.NullPointerException
at oracle.sql.LobPlsqlUtil.plsql_createTemporaryLob(LobPlsqlUtil.java:1352)
at oracle.jdbc.dbaccess.DBAccess.createTemporaryLob(DBAccess.java:997)
at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:240)
at oracle.sql.CLOB.createTemporary(CLOB.java:527)
at com.access.impl.AccessEJBBean.meld(AccessEJBBean.java:67)
(email: [email protected] ) -
DB Link between Oracle 10g and Oracle 9i for CLOB data type
How do I transport XMLType or CLOB from oracle 9i to Oracle 10G using DBLink?
Is any restrction to DBLink, while transfering CLOB with XML data from oracle 9i to Oracle 10G?
Please let me know how i resolve this issue.
Thanks in advance.
DKWell... it depends on what type of link you wish to create.
If you have same user with same password on both databases (9i and 10G), then you can create a public database link as
CREATE PUBLIC DATABASE LINK dblink USING 'dbalias';
Note: dbalias is the value from your TNSNAMES.ORA. The database from which you are creating the db link has to have the entry in TNS for other database.
Other method is to create a private db link
CREATE DATABASE LINK dblink CONNECT TO user IDENTIFIED by pwd using 'dbalias';
The number of open connections from a particular database is governed by init parameter DB_LINKS (this was in 8i.. not sure about higher versions)
HTH...
Message was edited by:
satishkandi -
XMLType and Oracle JMS compatibility
We need to receive messages from a Oracle-AQ queue with paylod_type XMLType,
and we would like manage this with JMS and MDB using OC4J 10.1.3.
Somebody know if is it possible to map such a queue as a JMS source or are there
limitations to the specific SYS.AQ$_JMS_MESSAGE paylod_type?
In the second case, what kind of workaround can we put in place? The XMLType is
a must in our environment, so we have to manage it in some way...
Thanks,
Giorgio.We need to receive messages from a Oracle-AQ queue with paylod_type XMLType,
and we would like manage this with JMS and MDB using OC4J 10.1.3.
Somebody know if is it possible to map such a queue as a JMS source or are there
limitations to the specific SYS.AQ$_JMS_MESSAGE paylod_type?
In the second case, what kind of workaround can we put in place? The XMLType is
a must in our environment, so we have to manage it in some way...
Thanks,
Giorgio. -
Using DB Adapter with XMLDB and CLOB
Hi,
with oracle xmldb i can store XMLs in lob or structured storage (s. Oracle® XML DB Developer's Guide 10g Release 2 (10.2) B14259-02).
Now my question:
If want to use a database adapter in the ESB to wake up several BPELs. Is there a functionality how i can transform such a clob into a XML where i can use XSLTs?
The db adapter does only map each column to one xml-tag...
If i try to use a table with xmltype the creation of a database adapter fails with:
"some tables contain columns that are not recognized by the database adapter, so they will captured as strings:
sys_nc_rowinfo$(sys.xmltype)
change teh type of the above columns to that of the closest supported type...."
Message was edited by:
HEWizardHi,
To get it working you have to create an AQ-table with payload type xmltype. The xmltype payload data type is available on rdbms 10g and up. If you are on 9i or lower use raw data type. Create a queue inside the AQ-table. I'm not quite sure what's the best scenario for you to the queue with data, but I would imagine that you could create a database trigger on the table you're talking about and enqueue the xml-data (payload) to the AQ-table. Thus using the AQ-table as a staging table for the ESB system.
Next, create an ESB system using an AQAdapter to dequeue the queue (like you did using a DBAdapter). The adapter can handle both single-user and multi-consumer queue's and all data types (raw, xmltype and object types).
Messages are dequeued generally within a second after you commited the transaction.
Kind regards,
H -
Hi!
I am currently trying to use Oracles XMLType with EJBs. Preferrably I would like to use CMP. Although the documentation http://e-docs.bea.com/wls/docs81/jdbc_drivers/oracle.html#1067224
says that XMLType is mapped to a CLOB, I get an error
ORA-00932: inconsistent datatypes: expected NUMBER got CLOB
when trying to update it. (I marked the bean as dbms-column-type OracleClob). If I do not mark it as OracleClob, I get an SQLException invalid type sqlType=2007 .
Is there another way to make XMLType work?
Thanks so much,
Hans-Peter Stoerr
PS: We are using Bea Weblogic Portal 8.1, but might migrate to 9. The driver is the oracle thin driver with oracle 9.2.Hi Brian,
Im not sure whats the issue with using DB Triggers. You could possibly have another
column(s) for created_by and updated_by and still use triggeres for the create_time
and update_time.
Inheritance would make it better if u have multiple tables which need the same
behaviour but the above solution maybe the easy one.
-Raj
"Brian Preston" <[email protected]> wrote:
>
Our DB has 4 'audit' columns : create_date, created_by, last_update_date,
last_updated_by.
We're currently not using ejbs, just J2SE, servlets & jsps, but I'm looking
into
using ejbs.
Is there any kind of design pattern for this? I've been searching the
newsgroups
about this. I can't use DB triggers because our application connects
to the DB
as the same user, regardless of the application user.
I'm trying to use inheritance as well, have a 'base' object that has
these audit
columns and have all the ejbs extend that base class.
Another issue is how would I trigger setting these columns? Do I have
to store
all the column values in ejbLoad and compare them in ejbStore? I've also
read
a little about the javax.ejb.SessionSynchronization interface, can I
use that?
Thanks,
Brian Preston -
Im using Oracle provider oledb version 8.1.7 and VC++ 6 are there any samples to insert CLOB type ,Please let me know
Hi Jill,
Welcome to the forum.
There are easier methods to output XML to a file, rather than using line-by-line UTL_FILE operations.
For example :
DECLARE
xml_result xmltype;
doc dbms_xmldom.DOMDocument;
BEGIN
xml_result := dbms_xmlgen.getXMLType('SELECT * FROM scott.dept');
doc := dbms_xmldom.newDOMDocument(xml_result);
dbms_xmldom.writeToFile(doc, 'TEST_DIR/my_file.xml', 'ISO-8859-1');
dbms_xmldom.freeDocument(doc);
END;
/or,
DECLARE
xml_result xmltype;
xml_prolog clob := '<?xml version="1.0" encoding="ISO-8859-1"?>'||chr(10);
BEGIN
xml_result := dbms_xmlgen.getXMLType('SELECT * FROM scott.dept');
dbms_xslprocessor.clob2file(xml_prolog || xml_result.getClobVal(), 'TEST_DIR', 'my_file.xml');
END;
/Both will produce :
<?xml version="1.0" encoding="ISO-8859-1"?>
<ROWSET>
<ROW>
<DEPTNO>10</DEPTNO>
<DNAME>ACCOUNTING</DNAME>
<LOC>NEW YORK</LOC>
</ROW>
<ROW>
<DEPTNO>20</DEPTNO>
<DNAME>RESEARCH</DNAME>
<LOC>DALLAS</LOC>
</ROW>
<ROW>
<DEPTNO>30</DEPTNO>
<DNAME>SALES</DNAME>
<LOC>CHICAGO</LOC>
</ROW>
<ROW>
<DEPTNO>40</DEPTNO>
<DNAME>OPERATIONS</DNAME>
<LOC>BOSTON</LOC>
</ROW>
</ROWSET>Hope that helps. -
BLOB and CLOB data in BI Publisher
Hello,
I have an XML file with blob and clob data in it. I am using BI desktop publisher to load the xml file and create the rtf template. I am getting the following error:
ConfFile: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdoconfig.xml
Font Dir: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\fonts
Run XDO Start
Template: C:\work\employee.rtf
RTFProcessor setLocale: en-us
FOProcessor setData: C:\work\employee.xml
FOProcessor setLocale: en-us
Do i need to install anything or am i missing any configuration to read the blob and clob? Please advise
thanksCheck this out, hopefully it'll help you
http://oraclebizint.wordpress.com/2007/11/12/oracle-bi-ee-101332-working-with-clob-fields/
Fiston -
Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field
Hello,
I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
Table structures are mentioned below:
OP:
Name Null Type
OP_NBR NOT NULL NUMBER(4) (Primary Key)
OP_DESC VARCHAR2(50)
OP_PAYLOD_XML CLOB
GM:
Name Null Type
GM_NBR NOT NULL NUMBER(4) (Primary Key)
GM_DESC VARCHAR2(40)
OP_NBR NOT NULL NUMBER(4) (Foreign Key)
GM_PAYLOD_XML CLOB
DM:
Name Null Type
DM_NBR NOT NULL NUMBER(4) (Primary Key)
DM_DESC VARCHAR2(40)
GM_NBR NOT NULL NUMBER(4) (Foreign Key)
DM_PAYLOD_XML CLOB
DE:
Name Null Type
DE_NBR NOT NULL NUMBER(4) (Primary Key)
DE_DESC NOT NULL VARCHAR2(40)
DM_NBR NOT NULL NUMBER(4) (Foreign Key)
DE_PAYLOD_XML CLOB
+++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT
j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
FROM
DE g, DM h, GM i, OP j
WHERE
h.dm_nbr = g.dm_nbr(+) and
i.gm_nbr = h.gm_nbr(+) and
j.op_nbr = i.op_nbr(+)
+++++++++++++++++++++++++++++++++++++++++++++++++++++
I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
Current O/P:
<resultSet>
<Record1>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<DM_PAYLOD_XML1>
<DE_PAYLOD_XML1>
</Record1>
<Record2>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML2>
<DM_PAYLOD_XML2>
<DE_PAYLOD_XML2>
</Record2>
<RecordN>
<OP_PAYLOD_XMLN>
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XMLN>
</RecordN>
</resultSet>
Now i want to change my SQL query so that i get following output structure:
<resultSet>
<Record>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<GM_PAYLOD_XML2> .......
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XML1>
<DM_PAYLOD_XML2> .......
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XML1>
<DE_PAYLOD_XML2> .......
<DE_PAYLOD_XMLN>
</Record>
<Record>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML1'>
<GM_PAYLOD_XML2'> .......
<GM_PAYLOD_XMLN'>
<DM_PAYLOD_XML1'>
<DM_PAYLOD_XML2'> .......
<DM_PAYLOD_XMLN'>
<DE_PAYLOD_XML1'>
<DE_PAYLOD_XML2'> .......
<DE_PAYLOD_XMLN'>
</Record>
<resultSet>
Appreciate your help in this regard!Hi,
A few questions :
How's your first query supposed to give you an XML output like you show ?
Is there something you're not telling us?
What's the content of, for example, <OP_PAYLOD_XML1> ?
I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
What's the db version BTW? -
Oracle XMLType deleteXML problem
Hi,
I am new using oracle xmltype, got a idiot problem when call deleteXML with xpath. I am hoping I can get help here. Code below describes how I did and what is the problem/
BTW, My oracle is
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
Thanks in advance.
Zhuang Zuo
software developer
[email protected]
===================================
-- step 1. create a table
create table XML_TABLE
uname varchar2(50),
xml_col xmltype
-- step 2. insert data
insert into xml_table
(uname, xml_col)
values (
'z1',
xmltype
<root>
<nodes>
<node attr="a" />
<node attr="b" />
</nodes>
</root>
-- step3. query data
select uname,
extract (xml_col, '/root') root,
extract (xml_col, '/root/nodes') nodes,
extract (xml_col, '/root/nodes/node') node,
extract (xml_col, '/root/nodes/node[@attr="a"]') node_a,
extract (xml_col, '/root/nodes/node[@attr="b"]') node_b
from xml_table
all above return data as expected.
-- "root" returns:
<root>
<nodes>
<node attr="a"/>
<node attr="b"/>
</nodes>
</root>
-- "nodes" returns:
<nodes>
<node attr="a"/>
<node attr="b"/>
</nodes>
-- "node" returns:
<node attr="a"/>
<node attr="b"/>
-- "node_a" returns:
<node attr="a"/>
-- "node_b" returns:
<node attr="b"/>
-- no problem so far
-- step 4. delete a node with xpath using update/deleteXML
update xml_table
set xml_col = deleteXML (xml_col, '/root/nodes/node[@attr="a"]')
where existsnode (xml_col, '/root/nodes/node[@attr="a"]') = 1
problem occurs here, showing in next step
-- step5. repeat step3, query data using same sql in step 3
--"root" returns data as expected:
<root>
<nodes>
<node attr="b"/>
</nodes>
</root>
--"nodes" returns data as expected:
<nodes>
<node attr="b"/>
</nodes>
--"node_a" return NO data, as expected
--however, "node", "node_b" return NO data either, even though "root" and "nodes" return correct data
why?
PLEASE HELP ....
Edited by: user10382724 on Apr 17, 2012 8:54 AMHi,
Looks like there's an issue with XML updating functions used over binary XMLType.
This thread describes a similar problem : {thread:id=1091574}
A possible workaround is the NO_XML_QUERY_REWRITE hint, but it's probably worth submitting the problem to Oracle Support anyway. -
Help - Inserting an XML document into a Oracle 8i Column (CLOB Type)
Hi JavaGurus,
I am looking for a simple java code which will take my XML document as input and insert the same into a Oracle 8i database's column which is of type CLOB.
Insert statement won't work and I can not use SQL Loader.
Any one?
JKMaybe you can adapt some of the code in Oracle's "LOB Datatype" example, which is a complete working program that stores and retrieves BLOBs and CLOBs.
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.html -
How to map CMP field to an Oracle XMLType?
How can we map a WLS700 EJB2.0 CMP field to an Oracle XMLType?
Is there some special configuration needed in the deployment descriptors?
Thanx,
NicoHi
System will prospose the existing object..just check if that the relavent and meaning ful object....if not create your own infoobject and map it...its not mandatory to use the proposed one..as its not the standard one..
Create a new object and include in the infosource and then map in transfer rule
Regards
Ram
Message was edited by: Ram
Maybe you are looking for
-
WHY doesmountain lion's battery drains so fast ?!
im really sad to see that my battery drains to fast compared to lion !
-
Hi I have a problem when i connect my MacBookPro 13 - 2011 to my HDTV Philips PFL8404 through HDMI. Adaptor and the cable work correctly on other HDTV (samsung, Innohit) The issue is that after a few minutes i have a green screen, and than it seems t
-
Hey, Sorry if the topic is misleading, but basically I'm looking for a better way to store and retrieve settings/properties to/from files. Currently I'm using "Properties", but I'm a bit worried as to how it stores the settings. Eg. If mutiple object
-
Acrobat closes after opening an embedded pdf
Hello I have created a pdf from Framemaker which in itself has a lot of pdf illustrations. When I click on one of these illustrations, they open in Acrobat but close the master file. Can I stop this?
-
My apps stopped downloading and or updating! iphone 4S latest update. It seems to get stuck on "waiting", that's what it says under the app I'm trying to download, but it never progresses from there. I have tried: Turning off and on Hard Reset, Holdi