How to encrypt/decrypt xml data into, and then out of IDS?
Hi,
How would we encrypt NPPI information being passed from an unencrypted xml through IDS, and then decrypt it on exit prior to Gendata.
The IDS SDK gave a reference to IDSEncryptionRule(), but insufficient examples of implementation.
It could be something like a single tag element, or even the entire xml, it's just not clear how to make it happen using native IDS methods.
Any thoughts or help to implement this security measure would be most welcome!
Thanks so much!
Edited by: lodit on Apr 10, 2013 2:56 PM
Hi there,
You would need to write a custom IDS rule that implements this function. You can refer to the IDS SDK book for info on writing a custom rule. IDSEncryptionRule does operations based on the request state received. Normally when an IDS rule is executed, the rules in the request type definition are executed with the RUN_FORWARD request state. Then they are executed with the RUN_REVERSE request state. An example of why this model is used would be the ATCReceiveFile. On RUN_FOWARD, it writes the contents of file segments in a message to a temporary file. Subsequent rules execute. Then on the RUN_REVERSE, the ATCReceiveFile does clean up routines to remove the temporary file.
So, armed with that knowledge, you can use the IDSEncryptionrule to perform on RUN_FORWARD (decrypt message variables for subsequent processing by Documaker) and then on RUN_REVERSE (encrypt message variables to send back to the client).
It should be apparent at this point that you need to use an encryption/decryption mechanism with the IDS client otherwise you won't be able to prepare the message to send or read the response. On the client side there are functions - consult the examples included in the IDS SDK (DSI_DSK in the installer package).
--Andy
Similar Messages
-
Inserting XML data into and XML template
I have XML data structured according to a schema. I also have a
template structured with the same schema, plus a schema for document formatting. I want to merge the XML data into the Template to produce an output file.
I know I can write a program to use XPath or DOM, but I am sure a generic solution already exists for this. I did not have any luck with google.
Suggestions?
thanks
d1I have XML data structured according to a schema. I also have a
template structured with the same schema, plus a schema for document formatting. I want to merge the XML data into the Template to produce an output file.
I know I can write a program to use XPath or DOM, but I am sure a generic solution already exists for this. I did not have any luck with google.
Suggestions?
thanks
d1 -
How Can One use XML data into our Java Program
I have an Java Program and an XML file contaning data. I want to parse the xml data and use into my Java Program. How can I do so.
Check out the org.xml.sax.XMLReader class.
-
How to Store an XML Data into Table?
Hi All,
My Requirement is "I Have an XML File (or) XML Data as CLOB, now I should decode this XML Data and find the equivalent data for columns in a table and then store that in a relational table",
Would be greatful if any one can provide me a feasible solution (or) good link where I can get this information with examples.
Thanks in advance,
Sunil NOr,
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:00.03
satyaki>
satyaki>
satyaki>drop table dump_tab;
Table dropped.
Elapsed: 00:00:01.08
satyaki>
satyaki>create table dump_tab
2 (
3 raw_xml clob
4 );
Table created.
Elapsed: 00:00:00.00
satyaki>
satyaki>
satyaki>desc dump_tab;
Name Null? Type
RAW_XML CLOB
satyaki>
satyaki>
satyaki>insert into dump_tab
2 select yy.rxml
3 from (
4 select (' <data>
5 <var name="document">
6 <string>Sales Order</string>
7 </var>
8 <var name="results">
9 <recordset rowcount="2">
10 <field name="sales_num">
11 <string>12345</string>
12 <string>60192</string>
13 </field>
14 <field name="ord_qty">
15 <string>10</string>
16 <string>50</string>
17 </field>
18 </recordset>
19 </var>
20 </data>'
21 ) rxml from dual
22 ) yy;
1 row created.
Elapsed: 00:00:00.00
satyaki>
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.00
satyaki>
satyaki>create table results
2 (
3 serial_no number(5),
4 sales_num number(7),
5 ord_qty number(10)
6 );
Table created.
Elapsed: 00:00:00.00
satyaki>
satyaki>desc results;
Name Null? Type
SERIAL_NO NUMBER(5)
SALES_NUM NUMBER(7)
ORD_QTY NUMBER(10)
satyaki>
satyaki>select * from dump_tab;
RAW_XML
<data>
<var name="document">
<string>Sales Order</string>
</var>
<var name="results">
<recordset rowcount="2">
<field name="sales_num">
<string>12345</string>
<string>60192</string>
</field>
<field name="ord_qty">
RAW_XML
<string>10</string>
<string>50</string>
</field>
</recordset>
</var>
</data>
Elapsed: 00:00:00.01
satyaki>
satyaki>
satyaki>ed
Wrote file afiedt.buf
1 insert into results(serial_no,sales_num,ord_qty)
2 with t
3 as (
4 select xmltype(raw_xml) xml from dump_tab
5 ),
6 t1 as (select rownum rn, t1.column_value.extract('*/text()') sales_num from t t, table(xmlsequence(t.xml.extract('//field[@name="sales_num"]/string'))) t1),
7 t2 as (select rownum rn, t2.column_value.extract('*/text()') ord_qty from t t, table(xmlsequence(t.xml.extract('//field[@name="ord_qty"]/string'))) t2)
8 select t1.rn x,
9 to_number(regexp_replace(xmlelement("e",sales_num).getstringval(),'<(|/)e>','')) sales_num
10 to_number(regexp_replace(xmlelement("d",ord_qty).getstringval(),'<(|/)d>','')) ord_qty
11 from t1,t2
12* where t1.rn = t2.rn
satyaki>/
2 rows created.
Elapsed: 00:00:00.00
satyaki>
satyaki>select * from results;
SERIAL_NO SALES_NUM ORD_QTY
1 12345 10
2 60192 50
Elapsed: 00:00:00.00
satyaki>Regards.
Satyaki De. -
How to insert large xml data into database tables.
Hi all,
iam new to xml. i want to insert data in xml file to my database tables.but the xml file size is very large. performance is also one of the issue. can anybody please tell me the procedure to take xml file from the server and insert into my database tables.
Thanks in advanceUnfortunately posting very generic questions like this in the forum tends not to be very productive for you, me or the other people who read the forum. It really helps everyone if you take a little time to review existing posts and their answers before starting new threads which replicate subjects that have already been discussed extensively in previous threads. This allows you to ask more sensible questions (eg, I'm using this approach and encountering this problem) rather than extremely generic questions that you can answer yourself by spending a little time reviewing existings posts or using the forum's search feature.
Also in future your might want to try being a little more specific before posting questions
Eg Define "very large". I know of customers who thing very large is 100K, and customers who think 4G is medium. I cannot tell from your post what size your files are.
What is the content of the file. Is it going to be loaded into a single record, or a a single table, or will it need to be loaded into multiple records in a single table or multiple records in multiple tables ?
Do you really need to load the data into exsiting relational tables or could your application work with relational views of the XML Content.
Finally which release of the database are you working with.
Define performance. Is it reasonable to expect to process this kind of document on this machine (Make, memory, #number of CPUs, CPU Speed, number of discs) in this period of time.
WRT to your original question. If you take a few minutes to search this forum you will find a very large number of threads with very similar titles to yours. These theads document a number of different approaches that can be used to solve this problem.
I suggest you start by looking for threads that cover topics like DBMS_XMLSTORE, XMLTable(), Relational Views of XML content, loading XML content in relational tables. -
How to retrieve the xml data into datagrid in vb6.0 using dom method
<?xml version="1.0" standalone="yes"?>
<Student_Details>
<Student>
<Name>sandeep</Name>
<Age>12</Age>
<Mobile>123456789</Mobile>
</Student>
<Student>
<Name>ololjk</Name>
<Age>kjlokmo</Age>
<Mobile>njonojniohuj</Mobile>
</Student>
<Student>
<Name>Sandeep Pr</Name>
<Age>12</Age>
<Mobile>9865231870</Mobile>
</Student>
<Student>
<Name>ololjk</Name>
<Age>kjlokmo</Age>
<Mobile>njonojniohuj</Mobile>
</Student>
<Student>
<Name>ololjk</Name>
<Age>kjlokmo</Age>
<Mobile>njonojniohuj</Mobile>
</Student>
<Student>
<Name>ololjk</Name>
<Age>kjlokmo</Age>
<Mobile>njonojniohuj</Mobile>
</Student>this forum is for vb.net, for vb6 you could try
http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier
http://forums.codeguru.com/forumdisplay.php?4-Visual-Basic-6-0-Programming
PS. vb6 is ancient software you might want to consider a language from this century -
How to store the XML data? file or database?
i'm frustrate at it.
If store XML data into files, then when i query any data,how can i search data using relationship as SQL?
But if store XML data into database.How can i transform the xml data to the data table?
Can any one give me an clear example.XML is perfect for data interchange and readability. However, to make it searchable you should resolve it properly into tables, in accordance of your own choice of model.
1. Investigate the XML files and resolve the model
<Person sex="male">John
<Pet animal="dog">Doggy</Pet>
<Pet animal="cat">Catty</Pet>
</Person>
2. Create the tables in your database, let one or several tables keep the raw xml for retrieval of original xml data.
--- XMLDocument ---
id XML_data
--- Person ---
id XML_Document_id sex name
(foreign key)
--- Pet ---
id Person_id animal name
(foreign key)
3. Resolve data from the xml files and insert it into the database. Do this through your ContentHandler, or from your DOM model.
--- XMLDocument ---
id XML_data
0 <Person>...</Person>
--- Person ---
id XML_Document_id sex name
0 0 male John
--- Pet ---
id Person_id animal name
0 0 dog Doggy
1 0 cat Catty
Gil -
How to Convert internal table data into xml and xml data into internal tab
Hi Guys,
I have a requirement that i have to convert the internal table data into xml format and viceversa . for my requirement i came to know that i have to use Transformations concept. i done the converting the data from internal table into xml data by using standard Tranformations. My Question is
1) Can i use same Transformation to convert the xml data into abap internal table. if it is possible then how ???
2) Is it possible using the standard Transformation or I have to go for XSLT approach
Please help me out from this guys,
Thanks and Regards
KotiHi Koti,
This is possible. There is a link. With the help of this link you can convert ABAP data to XML and vice versa.
Link: http://www.heidoc.net/joomla/index.php?option=com_content&view=article&id=15:sapxslt&catid=22:sap-xslt&Itemid=31 -
How to convert XML data into binary data (opaque data)
Hi,
I am trying to develop a process that delivers files after reading data from a database.
However, it is required not to deliver the data immediately. We want to perform some checks before the files get written.
So the way we want to design this is,
1. Read data from database (or any other input). The data is in XML format (this is a requirement, as in general, we have xml data)
2. This data is written, opaquely, to a JMS queue that can store binary data, along with what is the filename of the file that would be written (filename is passed using JMS Headers)
3. When required, another process reads the JMS queue's binary data, and dumps into a file
The reason I want to use opaque data while inserting in the JMS queue is, that enables me to develop a single process in Step 3 that can write any file, irrespective of the format.
My questions are
1. How to convert the xml data to opaque data. In BPEL I may use a embedded java, but how about ESB. Any other way....?
2. how to pass filename to the jms queue, when payload is opaque. Can I use a header attribute...custom attributes?
3. Which jms message type is better for this kind of requirement - SYS.AQ$_JMS_BYTES_MESSAGE or SYS.AQ$_JMS_STREAM_MESSAGEAna,
We are doing the same thing--using one variable with the schema as the source of the .xsl and assigning the resulting html to another variable--the content body of the email, in our case. I just posted how we did it here: Re: Using XSLT to generate the email HTML body
Let me know if this helps. -
How to parse xml data into java component
hi
everybody.
i am new with XML, and i am trying to parse xml data into a java application.
can anybody guide me how to do it.
the following is my file.
//MyLogin.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
class MyLogin extends JFrame implements ActionListener
JFrame loginframe;
JLabel labelname;
JLabel labelpassword;
JTextField textname;
JPasswordField textpassword;
JButton okbutton;
String name = "";
FileOutputStream out;
PrintStream p;
Date date;
GregorianCalendar gcal;
GridBagLayout gl;
GridBagConstraints gbc;
public MyLogin()
loginframe = new JFrame("Login");
gl = new GridBagLayout();
gbc = new GridBagConstraints();
labelname = new JLabel("User");
labelpassword = new JLabel("Password");
textname = new JTextField("",9);
textpassword = new JPasswordField(5);
okbutton = new JButton("OK");
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 5;
gl.setConstraints(labelname,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 2;
gbc.gridy = 5;
gl.setConstraints(textname,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 10;
gl.setConstraints(labelpassword,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 2;
gbc.gridy = 10;
gl.setConstraints(textpassword,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 15;
gl.setConstraints(okbutton,gbc);
Container contentpane = getContentPane();
loginframe.setContentPane(contentpane);
contentpane.setLayout(gl);
contentpane.add(labelname);
contentpane.add(labelpassword);
contentpane.add(textname);
contentpane.add(textpassword);
contentpane.add(okbutton);
okbutton.addActionListener(this);
loginframe.setSize(300,300);
loginframe.setVisible(true);
public static void main(String a[])
new MyLogin();
public void reset()
textname.setText("");
textpassword.setText("");
public void run()
try
String text = textname.getText();
String blank="";
if(text.equals(blank))
System.out.println("First Enter a UserName");
else
if(text != blank)
date = new Date();
gcal = new GregorianCalendar();
gcal.setTime(date);
out = new FileOutputStream("log.txt",true);
p = new PrintStream( out );
name = textname.getText();
String entry = "UserName:- " + name + " Logged in:- " + gcal.get(Calendar.HOUR) + ":" + gcal.get(Calendar.MINUTE) + " Date:- " + gcal.get(Calendar.DATE) + "/" + gcal.get(Calendar.MONTH) + "/" + gcal.get(Calendar.YEAR);
p.println(entry);
System.out.println("Record Saved");
reset();
p.close();
catch (IOException e)
System.err.println("Error writing to file");
public void actionPerformed(ActionEvent ae)
String str = ae.getActionCommand();
if(str.equals("OK"))
run();
//loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}hi, thanks for ur reply.
i visited that url, i was able to know much about xml.
so now my requirement is DOM.
but i dont know how to code in my existing file.
means i want to know what to link all my textfield to xml file.
can u please help me out. i am confused.
waiting for ur reply -
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 insert more than 32k xml data into oracle clob column
how to insert more than 32k xml data into oracle clob column.
xml data is coming from java front end
if we cannot use clob than what are the different options availableAre you facing any issue with my code?
String lateral size error will come when you try to insert the full xml in string format.
public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
boolean isUpdated = true;
Connection connection = null;
try {
connection = ConnectionManager.getConnection ();
//connection.setAutoCommit ( false );
PreparedStatement PREPARE_STATEMENT = null;
String sqlQuery = "UPDATE " + tableName + " SET " + columnName + " = ? WHERE ID =" + id;
PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
// converting string to reader stream
Reader reader = new StringReader ( strContents );
PREPARE_STATEMENT.setClob ( 1, reader );
// return false after updating the clob data to DB
isUpdated = PREPARE_STATEMENT.execute ();
PREPARE_STATEMENT.close ();
} catch ( SQLException e ) {
e.printStackTrace ();
finally{
return isUpdated;
Try this JAVA code. -
How to Dump XML data into table
Hi All,
We have one schema on a server.
We have created the same schema with only table structures on another new server.
Now we got the data from the original schema as XML files corresponding to each table.
For Example, we have Employee table created newly on a new server. Now we have the XML file which has Employee data. We have to dump this XML data into new EMPLOYEE table.
We have to dump these XML files data into corresponding tables.
How can we achieve this?
Please help me..
Thanks in advanceLook at this example:
Assume you have the following XML in a tempxml table (tempxml could be an external table):
create table tempxml (xml xmltype);
insert into tempxml values (xmltype(
'<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
<EMPNO>7521</EMPNO>
<ENAME>WARD</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>22-FEB-81</HIREDATE>
<SAL>1250</SAL>
<COMM>500</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
<EMPNO>7566</EMPNO>
<ENAME>JONES</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>02-APR-81</HIREDATE>
<SAL>2975</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW>
<EMPNO>7654</EMPNO>
<ENAME>MARTIN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>28-SEP-81</HIREDATE>
<SAL>1250</SAL>
<COMM>1400</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
<EMPNO>7698</EMPNO>
<ENAME>BLAKE</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>01-MAY-81</HIREDATE>
<SAL>2850</SAL>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
<EMPNO>7782</EMPNO>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>09-JUN-81</HIREDATE>
<SAL>2450</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7788</EMPNO>
<ENAME>SCOTT</ENAME>
<JOB>ANALYST</JOB>
<MGR>7566</MGR>
<HIREDATE>19-APR-87</HIREDATE>
<SAL>3000</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW>
<EMPNO>7839</EMPNO>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
<HIREDATE>17-NOV-81</HIREDATE>
<SAL>5000</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7844</EMPNO>
<ENAME>TURNER</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>08-SEP-81</HIREDATE>
<SAL>1500</SAL>
<COMM>0</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
<EMPNO>7876</EMPNO>
<ENAME>ADAMS</ENAME>
<JOB>CLERK</JOB>
<MGR>7788</MGR>
<HIREDATE>23-MAY-87</HIREDATE>
<SAL>1100</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW>
<EMPNO>7900</EMPNO>
<ENAME>JAMES</ENAME>
<JOB>CLERK</JOB>
<MGR>7698</MGR>
<HIREDATE>03-DEC-81</HIREDATE>
<SAL>950</SAL>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW>
<EMPNO>7902</EMPNO>
<ENAME>FORD</ENAME>
<JOB>ANALYST</JOB>
<MGR>7566</MGR>
<HIREDATE>03-DEC-81</HIREDATE>
<SAL>3000</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW>
<EMPNO>7934</EMPNO>
<ENAME>MILLER</ENAME>
<JOB>CLERK</JOB>
<MGR>7782</MGR>
<HIREDATE>23-JAN-82</HIREDATE>
<SAL>1300</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>'));You can insert into an empty EMP2 table this way:
SQL> insert into emp2
2 select myemp.empno, myemp.ename, myemp.job, myemp.mgr,
3 to_date(myemp.hiredate,'dd-mon-yy'), myemp.sal,
4 myemp.comm, myemp.deptno
5 from tempxml x, xmltable('/ROWSET/ROW'
6 PASSING x.xml
7 COLUMNS
8 empno number PATH '/ROW/EMPNO',
9 ename varchar2(10) PATH '/ROW/ENAME',
10 job varchar2(9) PATH '/ROW/JOB',
11 mgr number PATH '/ROW/MGR',
12 hiredate varchar2(9) PATH '/ROW/HIREDATE',
13 sal number PATH '/ROW/SAL',
14 comm number PATH '/ROW/COMM',
15 deptno number PATH '/ROW/DEPTNO'
16 ) myemp;
14 rows created.
SQL> select * from emp2;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.Max
http://oracleitalia.wordpress.com -
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; -
What is the best and easiest way to get xml data into the rtf document
Hello Frenz
I'm using rtf document(with bi publisher desktop plug in installed in the word document)... please suggest me the best way(to get the xml data from tables) to load the xml data into this rtf document..
I'm not developing oracle apps reports. It is for Oracle retail...
another doubt is... in the rtf document itself there is oracle bi publisher.. can it be used for generating xml data...
please bear with me and suggest me a way out
Thanks and regardsWhat will you be using in your production system to generate XML? Or are you just trying out BIP?
If you're familiar with dbms_xmlquery.getxml , you can pass your SQL to generate the XML output. Save the output in a file and use it in your RTF template.
If you have Oracle reports, you can create XML output when you run the report.
Maybe you are looking for
-
How can I get into updates in the app store on my ipod touch. I am told that it cannot connect to the itunes store, How can I get into updates in the app store on my ipod touch. I am told that it cannot connect to the itunes store
-
Export arabic character into csv file turns into question mark in sql dev
Hi, I am trying to export a table's output that contains some arabic and english mixed data, when I try to export it in csv, all the arabic characters change into question mark (?) but the same export is working fine on .xls or .xlsx. Since we have t
-
Lightroom 4. dose not handle RAW files from canon 5D MK 111.
I have purchased lightroom 4. It dose not handle RAW files from canon 5D MK 111. I have downloaded and ran the suggested file from Adobe, but still no luck. Anyone have the answer?
-
My iPad air2 camera was so bad
it it have a lot of noise! Even if photo it in light room (even if in shop) iis it normal? I expected for iPad air camera better than this
-
I cannot get firefox to open on my imac today Got the message to update on my mac-air and tried to do so but got the message that I "don't have permission to open some items"