How to store XML manaul in Database
Hi,
I have to store and retrieve XML manual in database.My XML manual has more than 100 tags and also un-strcutured(Document-centric manual). I tried with(XSU). If i use XSU, i need to create the table which has element name as column name. That is not possible since the elements will vary document to document . Also Nested elements and attributes are not able to be stored using XSU.
Can anyone tell me the Java API which perform the above task.
Thank you,
Regards,
senthil
With XSU the table is required to be created prior to storing an XML document. Also xml document attributes do not get stored. If elements vary, create a differen ttable for each of the xml document types.
Similar Messages
-
How to store xml data into file in xml format through java program?
HI Friends,
Please let me know
How to store xml data into file in xml format through java program?
thanks......
can discuss further at messenger.....
Avanish Kumar Singh
Software Engineer,
Samsung India Development Center,
Bangalore--560001.
[email protected]Hi i need to write the data from an XML file to a Microsoft SQL SErver database!
i got a piece of code from the net which allows me to parse th file:
import java.io.IOException;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.apache.xerces.parsers.SAXParser;
import java.lang.*;
public class MySaxParser extends DefaultHandler
private static int INDENT = 4;
private static String attList = "";
public static void main(String[] argv)
if (argv.length != 1)
System.out.println("Usage: java MySaxParser [URI]");
System.exit(0);
String uri = argv[0];
try
XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
MySaxParser MySaxParserInstance = new MySaxParser();
parser.setContentHandler(MySaxParserInstance);
parser.parse(uri);
catch(IOException ioe)
ioe.printStackTrace();
catch(SAXException saxe)
saxe.printStackTrace();
private int idx = 0;
public void characters(char[] ch, int start, int length)
throws SAXException
String s = new String(ch, start, length);
if (ch[0] == '\n')
return;
System.out.println(getIndent() + " Value: " + s);
public void endDocument() throws SAXException
idx -= INDENT;
public void endElement(String uri, String localName, String qName) throws SAXException
if (!attList.equals(""))
System.out.println(getIndent() + " Attributes: " + attList);
attList = "";
System.out.println(getIndent() + "end document");
idx -= INDENT;
public void startDocument() throws SAXException
idx += INDENT;
public void startElement(String uri,
String localName,
String qName,
Attributes attributes) throws SAXException
idx += INDENT;
System.out.println('\n' + getIndent() + "start element: " + localName);
if (localName.compareTo("Machine") == 0)
System.out.println("YES");
if (attributes.getLength() > 0)
idx += INDENT;
for (int i = 0; i < attributes.getLength(); i++)
attList = attList + attributes.getLocalName(i) + " = " + attributes.getValue(i);
if (i < (attributes.getLength() - 1))
attList = attList + ", ";
idx-= INDENT;
private String getIndent()
StringBuffer sb = new StringBuffer();
for (int i = 0; i < idx; i++)
sb.append(" ");
return sb.toString();
}// END PRGM
Now , am not a very good Java DEv. and i need to find a soln. to this prob within 1 week.
The next step is to write the data to the DB.
Am sending an example of my file:
<Start>
<Machine>
<Hostname> IPCServer </Hostname>
<HostID> 80c04499 </HostID>
<MachineType> sun4u [ID 466748 kern.info] Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 360MHz) </MachineType>
<CPU> UltraSPARC-IIi at 360 MHz </CPU>
<Memory> RAM : 512 MB </Memory>
<HostAdapter>
<HA> kern.info] </HA>
</HostAdapter>
<Harddisks>
<HD>
<HD1> c0t0d0 ctrl kern.info] target 0 lun 0 </HD1>
<HD2> ST38420A 8.2 GB </HD2>
</HD>
</Harddisks>
<GraphicCard> m64B : PCI PGX 8-bit +Accel. </GraphicCard>
<NetworkType> hme0 : Fast-Ethernet </NetworkType>
<EthernetAddress> 09:00:30:C1:34:90 </EthernetAddress>
<IPAddress> 149.51.23.140 </IPAddress>
</Machine>
</Start>
Note that i can have more than 1 machines (meaning that i have to loop thru the file to be able to write to the DB)
Cal u tellme what to do!
Even better- do u have a piece of code that will help me understand and implement the database writing portion?
I badly need help here.
THANX -
How to store España in database (in a column of a table)
Could you please tell me how to store España in database (in a column of a table).
regardsGenerally speaking you'll need a character set that can support the characters you require.
Here is a link to the supported character sets in 10.2.x.x:
[Character Sets|http://download.oracle.com/docs/cd/B19306_01/server.102/b14225/applocaledata.htm#i635016] -
How to store an image into database table
Hi
Can anyone tell me the way, how to store an image into database table.Hello,
May be this thread will help you in your requirement.
[FM for uploading Image to SAP;
Thanks,
Jayant -
How to store XML and search within tags
My question
===========
exactly what steps do you need follow to take an XML doc, store
it, and query based on a tag value.
The 8i Intermedia text option Reference refers to
XLM_SECTION_GROUP feature. However, no examples are given. There
is no user guide.
I searched Oracle's website and found one reference to
XML_SECTION_GROUP. The example given is a single row insert into
a CLOB column with a single pair of tags.
This whitepaper gives an example of an XML doc, and a query on
it:
XML Support in Oracle8i and Beyond
November 9, 1998
It doesn't list the steps in between storing the doc and quering
it. This is crucial to the whole thing: does XML_SECTION_GROUP
allow all nested tags below the top level to be sectioned and
indexed implicitly? Or do you need to tell Oracle about all the
tags you are interested in, in which case what value is added by
the XLM_SECTION_GROUP?
Does Oracle have some better examples on this?
Below is text cut and pasted from the whitepaper.
-----------x---------
Figure 5: InsuranceClaim Mixes Structured Data and Text
<?xml version="1.0"?>
<InsuranceClaim>
<ClaimID>12345</ClaimID>
<LossCategory>7</LossCategory>
<Settlements>
<Payment>
<Payee>Borden Real Estate</Payee>
<Date>12-OCT-1998</Date>
<Amount>200000</Amount>
<Approver>JCOX</Approver>
</Payment>
</Settlements>
<DamageReport>
A massive <Cause>Fire</Cause> ravaged the building
and
<Casualties>12</Casualties> people were killed.
Early
FBI reports indicate that <Motive>arson</Motive> is
suspected.
</DamageReport>
</InsuranceClaim>
Once instances of iFS file types (including XML-based ones) are
stored in the database, their
content can be searched using standard SQL queries, and these
files can be organized, browsed,
and versioned using familiar tools like the Windows Explorer.
So an insurance agent sees a
directory of InsuranceClaim files sheFs recently worked on in
the field, while an
InsuranceClaim-processing application developer can work with
the information in the
InsuranceClaim in any way he needs to.
XML-Enabled "Section Searches" in ConText
Any XML documents or document fragments saved into "text blobs"
in the database can be
enabled for indexing by Oracle8i InterMediaFs ConText
text-search engine. ConText has been
enhanced for Oracle8i to allow developers to pinpoint their
searches to a particular section of a
document, where sections are implicitly defined by the XML tags
in the document (fragment).
Since ConText is seamlessly integrated into the database and
the SQL language, developers can
use SQL to perform queries that involve both structured data
and indexed document fragments.
For example, Figure 6 shows the SQL statement you would write
to search one million
Insurance Claims in your database to answer the question, "How
much money has Jim Cox
approved to date in settlement payments for arson-related fire
claims? "
Figure 6: Searching on a Column & Text in XML
Sections
SELECT SUM(Amount)
FROM Claim_Header ch,
Claim_Settlements cs,
Claim_Settlement_Payments csp
WHERE csp.Approver = 'JCOX'
AND CONTAINS (DamageReport, 'Arson WITHIN Motive') >
0
AND CONTAINS (DamageReport, 'Fire WITHIN Cause' ) >
0
AND . . . /* Join Clauses */
nullGeoff Ingram (guest) wrote:
: My question
: ===========
: exactly what steps do you need follow to take an XML doc,
store
: it, and query based on a tag value.
: The 8i Intermedia text option Reference refers to
: XLM_SECTION_GROUP feature. However, no examples are given.
There
: is no user guide.
: I searched Oracle's website and found one reference to
: XML_SECTION_GROUP. The example given is a single row insert
into
: a CLOB column with a single pair of tags.
: This whitepaper gives an example of an XML doc, and a query on
: it:
: XML Support in Oracle8i and Beyond
: November 9, 1998
: It doesn't list the steps in between storing the doc and
quering
: it. This is crucial to the whole thing: does XML_SECTION_GROUP
: allow all nested tags below the top level to be sectioned and
: indexed implicitly? Or do you need to tell Oracle about all
the
: tags you are interested in, in which case what value is added
by
: the XLM_SECTION_GROUP?
: Does Oracle have some better examples on this?
: Below is text cut and pasted from the whitepaper.
: -----------x---------
: Figure 5: InsuranceClaim Mixes Structured Data and Text
: <?xml version="1.0"?>
: <InsuranceClaim>
: <ClaimID>12345</ClaimID>
: <LossCategory>7</LossCategory>
: <Settlements>
: <Payment>
: <Payee>Borden Real Estate</Payee>
: <Date>12-OCT-1998</Date>
: <Amount>200000</Amount>
: <Approver>JCOX</Approver>
: </Payment>
: </Settlements>
: <DamageReport>
: A massive <Cause>Fire</Cause> ravaged the building
: and
: <Casualties>12</Casualties> people were killed.
: Early
: FBI reports indicate that <Motive>arson</Motive> is
: suspected.
: </DamageReport>
: </InsuranceClaim>
: Once instances of iFS file types (including XML-based ones)
are
: stored in the database, their
: content can be searched using standard SQL queries, and
these
: files can be organized, browsed,
: and versioned using familiar tools like the Windows
Explorer.
: So an insurance agent sees a
: directory of InsuranceClaim files sheFs recently worked on
in
: the field, while an
: InsuranceClaim-processing application developer can work
with
: the information in the
: InsuranceClaim in any way he needs to.
: XML-Enabled "Section Searches" in ConText
: Any XML documents or document fragments saved into "text
blobs"
: in the database can be
: enabled for indexing by Oracle8i InterMediaFs ConText
: text-search engine. ConText has been
: enhanced for Oracle8i to allow developers to pinpoint their
: searches to a particular section of a
: document, where sections are implicitly defined by the XML
tags
: in the document (fragment).
: Since ConText is seamlessly integrated into the database and
: the SQL language, developers can
: use SQL to perform queries that involve both structured data
: and indexed document fragments.
: For example, Figure 6 shows the SQL statement you would
write
: to search one million
: Insurance Claims in your database to answer the
question, "How
: much money has Jim Cox
: approved to date in settlement payments for arson-related
fire
: claims? "
: Figure 6: Searching on a Column & Text in XML
: Sections
: SELECT SUM(Amount)
: FROM Claim_Header ch,
: Claim_Settlements cs,
: Claim_Settlement_Payments csp
: WHERE csp.Approver = 'JCOX'
: AND CONTAINS (DamageReport, 'Arson WITHIN Motive') >
: 0
: AND CONTAINS (DamageReport, 'Fire WITHIN Cause' ) >
: 0
: AND . . . /* Join Clauses */
Currently you cannot break apart an arbitrary XML doc and store
it into the database without using XSLT to create DDL to insert
it. You can create a schema and have XML be read and written to
it. Check out the XML SQL Utility available here for download.
As for the section searching, in 8.1.5 you can only get section
searching not hierarchical searches. interMedia in this version
doesn't understand the XML structure. This will come in 8.1.6.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
How to store files in mysql database using JSP?
I'm developing an online recruitment system using JSP in server side. For the users who registers in it, I want them to upload their cv's from the web site so that I can store it in the database..I'm using mysql as the db..
Can I know how to do it.?..or else is there any better way of doing that?
Need a quick reply..TxThe best way to put data in a database in a JSP is to not do it. Instead, use a Servlet that calls a DataAccessObject. The DAO puts the data in the DB and the servlet gives the data to the DAO. The JSP does nothing but display results.
Take a google for JSP MVC and DAO. BalusC has a great example of DAO and a JSP that uses one on his blog. -
How to store file content in database??????
how to store file in database and retrived
How to use Google to search for answers to questions that have been asked literally thousands of times previously??????
How to post into the correct forum???????
How to use less punctuation?????? -
HOW TO Store Vectors in oracle database
Hello everyone,
In my project, Iam having a Jtable WITH MULTIPLE ROWS AND COLUMNS as my GUI, INWHICH USER TYPES HIS VALUES. THE NUMBER OF ROWS AND COLUMNS ARE SELECTED BY USER WHICH ARE DYNAMIC.
THE PROBELM IS I DON'T KNOW HOW TO STORE EACH ROW VALUES IN DATABASE.I HAVE TO TAKE EACH ROW VALUES AND STORE THEM IN DATABASE. I TAKE EACH ROW AND STORE IT IN A VECTOR. AFTER THAT ONLY THE PROBLEM RAISES.
IS THERE ANY WAY TO STORE VECTORS IN DATABASE.
PLEASE HELP ME IN SOLVING THIS PROBLEM.
THANK YOU.Bathina,
A "JTable" is usually used to visualize a database table. You seem to want to store a "JTable" in your database. It looks like you may not know much about relational databases.
If you haven't already done so, I suggest reading the "Oracle Concepts" manual. It is available from:
http://tahiti.oracle.com
Good Luck,
Avi. -
How to store xml document in d/b using jsp
hai,
Iam doing one web application in JSP, i have a requirement to store the xml document in database. We have to use some xml parsers, so can anyone please give me the related code in JSP.
regards,
Praveen Vinnakota.If you have to store the Whole XML Document then I don't think you need to mess with XML Parsers. I mean simply the XML File in the Database Field where it has to stored
Bye for now
CSJakharia -
How to store xml-file direct on file-directory on server ?
Hello,
I have created a xml-data by using xmlelements, xmlforest .... and so on in a sql-statement and want to store it as file in a ( windows) server-directory.
I can find some samples to store it in XML-DB by using dbms_xmlGEN and dbms_XDB,
but how to store it direct ?
thank you
NorbertTry dbms_xmldom.writeToFile()..
Or create a resource from your SQL Statement using dbms_xdb.createResource() and then access the resource via FTP or HTTP -
How To Store XML Fragments Using Functions Such As XMLElement
Hi
Not sure what I am missing. I wish to store XML fragments in variables so can pass around and concatenate with other fragments to make final XML document. Even before attempting to concatenate XML fragments, I am struggling to store any XML fragment in a variable. I am trying to use simple functions such as XMLElement to generate XML so can store in variable. I have seen many examples of XMLElement in SQL select statement. Can XMLElement be used in plsql? XMLElement says it returns value of type XMLType. Functions such as XMLElement make generating XML easier than creating all tags manually.
Below is simple example that demonstrates what I would like to do. I would like to be able to pass the XML fragment as either XMLType or clob. I receive error saying PLS-00201: identifier 'XMLELEMENT' must be declared
declare
vTheData XMLType;
vTheDataClob clob;
begin
vTheData:= XMLelement("empno",'1234567');
vTheDataClob:= xmlelement("empno",'1234567').getclobval();
end;
Where as I can use below, but surely don't have to use select into from dual method. I just expect can use XMLElement function in plsql same as sql, such as most other functions eg length, rtrim etc.
declare
vTheData XMLType;
vTheDataClob clob;
begin
select xmlelement("empno",'1234567')
into vTheData
from dual;
select xmlelement("empno",'1234567').getclobval()
into vTheDataClob
from dual;
end;
Hope this makes sense.
ThanksHaving said that, is there a more elegant way to achieve below. That is populate two XML fragments and concatenate together.
Sure, why not just only one statement?
select XMLConcat(
XMLElement( ... )
, XMLElement( ... )
into vTheResult
from dual;
As a second question, is it better to build and pass XML fragments as XMLType or clob?
I would say stay with XMLType but it depends on your requirement.
I generally avoid passing around pieces of data, SQL/XML functions are powerful in the way they can be used with set operations, so using them in a piecewise approach kinda negates what they're for. -
How to store xml data fragments, that will not be queried?
Hello,
Delphi Client application communicates with Java Server application via XML messages. Client sends XML message over HTTP Post method. Java Servlet gets XML message, parses it, performs requested action (select/insert/update/delete), generates resulting response and sends it back to the Client.
I use Oracle DB XE 10.2.
For example: Client sends a request to the server, to append certain Order with new Product info:
Request:
<?xml version="1.0" encoding="UTF-8" ?>
- <Request OrderID="123123123" Action="NewProduct">
- <Product TempProdID="2" ProdName="L01" VisualID="1" Amount="1" TechClass="1" TechSubject="1" TechVersion="0" TechName="TestTech" ElemOk="0">
<Modified UserID="XXX" UserGroup="XXX" GroupLevel="0" />
- <QuickInfo>
<ProdIcon Format="PNG"
Encoding="Base64">iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAA
lC+aJAAAAA3RSTlP////6yOLMAAAAvElEQVR42u3aQQ6EIAwAQP7/afe0
mo1mBVur0emJgwGmRDFNWwvH9I153OpjyoisefqXW3afm4WypP+MgomvT
z8AAAAAAAAAAAAAAMAzAClzAWQAdvexfqATEKmA/Fm0rYs5ozvoAWyWj4
ZqJ9efQKR8BJAHOPEdKAAc/lLdAhC/K68EBG+JWwAixfABgF8Jf6MAAAA
AAAAAAAAAAAAALwRUGgAAAAAAsgGJ3cfVrcfFl2jiIZzV+V7Zd/8BOtNi
0MnJ58oAAAAASUVORK5CYII=
</ProdIcon>
<Parameters />
</QuickInfo>
- <TechProduct CurVer="1" MinVer="1" TotalItems="330" ItemNodeSize="55074">
- <SubItem Class="TPlGraph" BindID="00B9C004">
<PropList />
- <SubItem Ident="Profiles" Class="TProfileList" Child="1" BindID="0188598C">
<PropList />
- <SubItem Class="TPlProfile" Child="1" BindID="018CA6CC">
- <PropList>
<Property PropIdent="ProfBaze0X" ValText="0" />
<Property PropIdent="ProfBaze0Y" ValText="990" />
<Property PropIdent="ProfBaze1X" ValText="990" />
<Property PropIdent="ProfHier0" ValText="0" />
- <Property PropIdent="InBorder" ValIdent="None" ValText="Nėra">
<ExtValue ColIdent="ItemCode" Value="None" />
<ExtValue ColIdent="Type" Value="" />
<ExtValue ColIdent="Filter" Value="" />
<ExtValue ColIdent="Width" Value="0" />
<ExtValue ColIdent="TechCall" Value="" />
</Property>
</PropList>
</SubItem>
</SubItem>
</SubItem>
</TechProduct>
</Product>
</Request>
I use DOM parsers to parse the received requests, extract certain info and insert it into relational tables using standart SQL queries.
My question is: what is the best way to store XML data fragments, that are not required to be saved relationally? I need to save the content of node <TechProduct> from the above example to relational table's column. There will be no need to query this column, no need to use relational views. I will use it only when Client application will request to modify certain order's product. Then I will have to send back the same <TechProduct> node via XML response.
So what column type do I have to use? CLOB? XMLType? Is it better to use object types? Do I have to register XML Schema for better performance? The size of the fragment can be ~2MB.
Thanks for your help
Message was edited by:
KichasThank you for reply,
As you suggested, I will use XMLType storage as CLOB (without XML Schema).
As I mentioned before, I use Java Servlet, deployed on Tomcat WebServer, to receive XML messages from Client application via HTTP POST method.
I use these libs to get the XML payload and parse it into a Document:
import org.w3c.dom.*;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
And here is the code:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
// get the XML payload and parse it into a Document
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document dom;
InputSource input = new InputSource(request.getInputStream());
dom = docBuilder.parse(input);
catch(Exception ex) {
System.out.println("Exception thrown in XmlService");
ex.printStackTrace();
throw new ServletException(ex);
I create a relational table, that contains XMLType column:
CREATE TABLE xwarehouses (
warehouse_id NUMBER,
warehouse_spec XMLTYPE)
XMLTYPE warehouse_spec STORE AS CLOB;
Now I want to insert all DOM Document into XMLType column. So I do like this:
import oracle.xdb.XMLType;
String SQLTEXT = "INSERT INTO XWAREHOUSES (WAREHOUSE_ID, WAREHOUSE_SPEC) VALUES (?, ?)";
XMLType xml = XMLType.createXML(con,dom);
PreparedStatement sqlStatement = con.prepareStatement(SQLTEXT);
sqlStatement.setInt(1,2);
sqlStatement.setObject(2,xml);
sqlStatement.execute();
sqlStatement.close();
dom is the Document, that I got from HTTP Request input stream.
My servlet throws an exception:
java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLParseException
at XmlService.GetMatListServiceHandler.processRequest(GetMatListServiceHandler.java:111)
at XmlService.XmlServiceHandler.handleRequest(XmlServiceHandler.java:43)
at XmlService.XmlServiceServlet.doPost(XmlServiceServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
why does he needs oracle.xml.parser.v2.XMLParseException? I don't use Oracle parser? Does this code line throws the exception (I am not able to debug my code, because I have not configured JDeveloper to be able to use Remote Debuging):
XMLType xml = XMLType.createXML(con,dom);
Does it reparses the given dom Document or what?. When I deploy xmlparserv2.jar to Tomcat, everything is ok, application inserts XML data into XMLType column.
Is there another way to insert the whole org.w3c.dom Document or Document fragment (that is already parsed) into XMLType column. Can you provide any sample code?
The Document may contain national symbols, so they should be correctly stored and then later retrieved.
Many thanks. -
How to store XML data into Oracle Table
I had trouble to store XML data into Oracle Table with XDK (Oracle 8.1.7 ). The error is:
C:\XDK_Java_9_2\xdk\demo\java\Test>java testInsert Dept.xml
<Line 1, Column 1>: XML-0108: (Fatal Error) Start of root element expected.
Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: Start of root element expected.
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2263)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1333)
at testInsert.main(testInsert.java:8)
Here is my xml file:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DEPTNO>10</DEPTNO>
<DNAME>ACCOUNTING</DNAME>
<LOC>NEW YORK</LOC>
</ROW>
<ROW num="2">
<DEPTNO>20</DEPTNO>
<DNAME>RESEARCH</DNAME>
<LOC>DALLAS</LOC>
</ROW>
<ROW num="3">
<DEPTNO>30</DEPTNO>
<DNAME>SALES</DNAME>
<LOC>CHICAGO</LOC>
</ROW>
<ROW num="4">
<DEPTNO>40</DEPTNO>
<DNAME>OPERATIONS</DNAME>
<LOC>BOSTON</LOC>
</ROW>
</ROWSET>
and here is structure of table:
Name Null? Type
DEPTNO NOT NULL NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
and here is my Java Code:
import java.sql.*;
import oracle.xml.sql.dml.OracleXMLSave;
public class testInsert{
public static void main(String[] args) throws SQLException{
Connection conn = getConnection();
OracleXMLSave sav = new OracleXMLSave(conn,"scott.tmp_dept");
sav.insertXML(args[0]);
sav.close();
conn.close();
private static Connection getConnection()throws SQLException{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@amt-ebdev01:1521:mydept","scott","tiger");
return conn;
Could you help me ? Thanks !The problem is that you need to pass avalid URL , Document...
Please try this code instead:
import java.net.*;
import java.sql.*;
import java.io.*;
import oracle.xml.sql.dml.OracleXMLSave;
public class testInsert
public static void main(String[] args) throws SQLException{
Connection conn = getConnection();
OracleXMLSave sav = new OracleXMLSave(conn,"scott.temp_dept");
URL url = createURL(args[0]);
sav.insertXML(url);
sav.close();
conn.close();
private static Connection getConnection()throws SQLException{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@dlsun1982:1521:jwxdk9i","scott","tiger");
return conn;
// Helper method to create a URL from a file name
static URL createURL(String fileName)
URL url = null;
try
url = new URL(fileName);
catch (MalformedURLException ex)
File f = new File(fileName);
try
String path = f.getAbsolutePath();
// This is a bunch of weird code that is required to
// make a valid URL on the Windows platform, due
// to inconsistencies in what getAbsolutePath returns.
String fs = System.getProperty("file.separator");
if (fs.length() == 1)
char sep = fs.charAt(0);
if (sep != '/')
path = path.replace(sep, '/');
if (path.charAt(0) != '/')
path = '/' + path;
path = "file://" + path;
url = new URL(path);
catch (MalformedURLException e)
System.out.println("Cannot create url for: " + fileName);
System.exit(0);
return url; -
Hi experts,
I have an abap applicatrion that has to store xml files received from a web service.
Where is better to store these files, in sap transparent tables or in the IXOS for example?
ThanksBrad,
An java application will call that BAPI passing the XML when error occurs in the process. The XML will contain the error details.
I want to associate the error messages with the respective XMLs.
What do you mean with "object type / object value" ?
Thanks
Edited by: Jorge Castro on Jan 18, 2011 5:09 PM -
How to store any file in database using Forms? EVEN non OLE Compliant
I have to store and retrieve any file (not only image and OLE compatilble file) in the database and retrieve it later without using Forms and email it using java stored procedure. How do I do that?
I used OLE, but the problem with this is later when I retrieve it, some OLE specific control information is also retrieved, which means the data stored is not only pure data.
In the forms, I just want to give the file name and it should store that file into the database as we do with READ_IMAGE_FILE. Is there any way of achieving this?
Thank you.
Bijay
nullPlease refer to this link:
http://www.dba-oracle.com/t_storing_insert_photo_pictures_tables.htm
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]
Maybe you are looking for
-
ABAP WebService Created but unable to locate in Web Services Navigator
Hi all, We have got a SAP WAS 640 system and had created an RFC and converted into a Web Service via transaction code SE37. Have also confirmed to be working using the test page. However, in the Web Services Navigator homepage, I am unable to find th
-
We just upgraded to Adobe Illustrator CC and all my toolbars and icons and menus are huge.. I just need to know how to make them normal sized again.
-
Payment Terms description for free entry(p006-Others)
Hi Frds, I have one requirement regarding we have 6 payment terms but last payment term p006-Others,if user is creating vendor master record if he selected payment terms p006 user has to enter the description manully based on his requirement. for thi
-
How to code a "tween" object moving like in Flash?
As you may know in Flash the user can easily implement movements (including rotations) of objects by so called "tweens". The developer defines e.g. the start and end position of a picture and how many rotations should be applied and Flash generates t
-
Tax invoice and sundary billing
Hi experts, what is Tax invoice and sundry billing ,and how they are related??? thanks.