Load XML data from UNIX Server Directly into Relational Database Tables
Is there a way I can load data from an XML File into Oracle Tables , without having the Input XML file in some Oracle Server Directory. My XML File resides on UNIX Application server. And I need to directly load the data into Database tables. Without loading them into the Database Directory.
Also I am looking for a solution that would not load my Database much and effect other running processes. Can it be done using SQL Loader ?
Oracle Database Version is : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
Thanks for your reply ,
Please would you quote an Example about : 'Load the file into that table using SQL*Loader' (From UNIX Server) Or instance of some existing thread that relates to my situation.
The Size of the File would be about 3 GB. For a similar requirement one of my peers Code which used XMLTABLE and XPATH Approach consumed a lot of resources while running and caused the other Database Applications to slow down. Thus those guys have come up with an approach to :
Parse XML using a C Code using some STRING Functions => For a CSV or Fixed width .dat file and then use SQL Loader to just load the file into Tables.
This approach is efficient in terms of Resources and Time(Takes 5 mins). But I am not confident about parsing XML based on String based C Functions.
Please comment about this approach . Also if possible Suggest the best efficient way of doing this.
Similar Messages
-
How do I import the data from Excel (.xls) file into Oracle Database table
I have an excel file with 5 columns of 5000 rows.
I have to import 5000 rows of data into my oracle table with
same column names & Data types.
What is the best advise for this ?
Thanks.
SriniYou can connect to Oracle from Excel directly. I know you can read data but am not sure if you can export data.
Other option is to import the data into Access.
Create an ODBC connection for Oracle
Use the to connect to Oracle from Access
Export data to Oracle from Access
Shakti
http://www.impact-sol.com
Developers of Guggi Oracle - Tool for DBAs and Developers -
Looking for a solution or service to export data from a dynamic form into a database
As the title of this discussion states, I'm looking for a solution or service to export data from a dynamic form into a database to be used for reporting. Creating the dynamic form is not a problem, it's getting it into a database that's more of a nuisance. A dynamic form is needed in order to provide skip logic, hide/reveal, and other similar dynamic features.
The database hasn't been created, so just looking for the easiest, more effective and dependable solution. The key is being able to run reports off the data later.So i set up 2 residential grade routers to test this out. Seems to be working okayish. I believe with directional antenae routers I should achieve what I need.
As for security I configured each device separately. I set them so only allow the MAC address of the other through wireless. This seems to be the best system for me. Once they are connected even if a MAC is spoofed of the other router it drops automatically because they are always connected. My wired devices get plugged in and recieve an IP from my main network.
There more testing to be done, but it seems to be working.
Thanks for your input and suggestions guys. I will be marking this topic as answered. -
Read data from Excel and write into oracle database
Hi
I want to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
Thanks and Regards
NeetaHai,
I am suggesting the solution.
I will try out and let u know soon.
Make a coma separated file from your excel file.
Assuming that your requirement allows to make a csv file.
This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
You do not want to go via sql Loader?
For reading the excel file itself do you want java? -
How to select the data from a Maintainance View into an internal table
Hi All,
Can anybody tell me how to select the data from a Maintainance View into an internal table.
Thanks,
srinivas.HI,
You can not retrieve data from A mentenance view.
For detail check this link,
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
Regards,
Anirban -
Get the data from excel and insert into the database
I want to read the data from excel file, get the data from excel and insert into the database.
You can use the Apache POI HSSF API to read data from Excel files and you can use the Sun JDBC API to insert data in database.
This has nothing to do with JSP/JSTL. -
Load XML-data from large file into plain table
We have to load data from an XML file to a relational table row by row.
The structure of the data is very simple:
<ROOT>
<repReport>
<KNZ>XY</KNZ>
<LA>test123</LA>
<Ident>AA20</Ident>
</repReport>
<repReport>
</repReport>
</ROOT>.
The table econtains the fields KNZ, LA, Ident, ...
If the file is small the following PL/SQL-code works fine:
CREATE OR REPLACE PROCEDURE Loadxml_Epd AS
fil BFILE ;
len INTEGER;
insrow INTEGER;
ctxHdl NUMBER;
buffer_c CLOB ;
amt NUMBER := dbms_lob.lobmaxsize;
src_offset NUMBER := 1 ;
dst_offset NUMBER := 1 ;
lang_ctx NUMBER := dbms_lob.default_lang_ctx;
warning NUMBER;
errNo NUMBER;
errMsg VARCHAR2(1999);
BEGIN
fil := BFILENAME('XML_DIR','200412MKBReport.xml');
DBMS_LOB.OPEN(fil, DBMS_LOB.LOB_READONLY);
len := DBMS_LOB.GETLENGTH(fil);
INSERT INTO INIT_CLOB(init) VALUES( EMPTY_CLOB())
RETURNING init INTO buffer_c;
dbms_lob.loadfromfile(buffer_c,fil, amt, dst_offset, src_offset);
ctxHdl := dbms_xmlsave.newContext ('SST_XML_EPD');
dbms_xmlsave.setRowTag (ctxHdl , 'repReport');
dbms_xmlsave.SetIgnoreCase(ctxHdl , 1);
dbms_xmlsave.SetSqlToXmlnameEscaping (ctxHdl , TRUE);
dbms_xmlsave.propagateOriginalException(ctxHdl , TRUE);
dbms_xmlsave.SetCommitBatch(ctxHdl , 1);
dbms_xmlsave.SetBatchSize(ctxHdl , 1);
insrow := DBMS_XMLSAVE.insertXML(ctxHdl,buffer_c);
DBMS_OUTPUT.PUT_LINE('Anzahl Sätze:' || TO_CHAR(insrow,'999999999'));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLCODE);
errMsg := SQLERRM;
DBMS_OUTPUT.PUT_LINE(SUBSTR(errMsg,1,2000));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
END;
But if the file is larger (50 MB in our case) this does not work. In various documents we found that we have to use another sort of XML-parser but we did not find any example how this is really done.
Does anybody have an example how to load this data that is as simple as our problem?We have to load data from an XML file to a relational table row by row.
The structure of the data is very simple:
<ROOT>
<repReport>
<KNZ>XY</KNZ>
<LA>test123</LA>
<Ident>AA20</Ident>
</repReport>
<repReport>
</repReport>
</ROOT>.
The table econtains the fields KNZ, LA, Ident, ...
If the file is small the following PL/SQL-code works fine:
CREATE OR REPLACE PROCEDURE Loadxml_Epd AS
fil BFILE ;
len INTEGER;
insrow INTEGER;
ctxHdl NUMBER;
buffer_c CLOB ;
amt NUMBER := dbms_lob.lobmaxsize;
src_offset NUMBER := 1 ;
dst_offset NUMBER := 1 ;
lang_ctx NUMBER := dbms_lob.default_lang_ctx;
warning NUMBER;
errNo NUMBER;
errMsg VARCHAR2(1999);
BEGIN
fil := BFILENAME('XML_DIR','200412MKBReport.xml');
DBMS_LOB.OPEN(fil, DBMS_LOB.LOB_READONLY);
len := DBMS_LOB.GETLENGTH(fil);
INSERT INTO INIT_CLOB(init) VALUES( EMPTY_CLOB())
RETURNING init INTO buffer_c;
dbms_lob.loadfromfile(buffer_c,fil, amt, dst_offset, src_offset);
ctxHdl := dbms_xmlsave.newContext ('SST_XML_EPD');
dbms_xmlsave.setRowTag (ctxHdl , 'repReport');
dbms_xmlsave.SetIgnoreCase(ctxHdl , 1);
dbms_xmlsave.SetSqlToXmlnameEscaping (ctxHdl , TRUE);
dbms_xmlsave.propagateOriginalException(ctxHdl , TRUE);
dbms_xmlsave.SetCommitBatch(ctxHdl , 1);
dbms_xmlsave.SetBatchSize(ctxHdl , 1);
insrow := DBMS_XMLSAVE.insertXML(ctxHdl,buffer_c);
DBMS_OUTPUT.PUT_LINE('Anzahl Sätze:' || TO_CHAR(insrow,'999999999'));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLCODE);
errMsg := SQLERRM;
DBMS_OUTPUT.PUT_LINE(SUBSTR(errMsg,1,2000));
IF DBMS_LOB.ISOPEN(fil) = 1 THEN
DBMS_LOB.CLOSE(fil);
END IF;
END;
But if the file is larger (50 MB in our case) this does not work. In various documents we found that we have to use another sort of XML-parser but we did not find any example how this is really done.
Does anybody have an example how to load this data that is as simple as our problem? -
Get xml data from a web service into Forms?
Hello folks! I am reading active directory info from a web service into forms via imported java classes. I can read from functions that return strings just fine, but I have to get the output from getGroupUsers which returns an XmlDataDocument. How do I read this in and parse it in Forms?
I will be grateful if y'all could point me to an example.
Thank you,
Gary
P.S. Here is a snippet of how I get the full name by passing an ID:
DECLARE
jo ora_java.jobject;
rv varchar2(100);
BEGIN
jo := ADSoapClient.new;
rv := ADSoapClient.getUserName(jo, 'user_ID');
:block3.fullname := rv;Hello,
Since you are already dealing with server-side JAVA, I would suggest you create a method that would do the parsing server-side and what your PL/SQL will be dealing with is just the return string.
Here is a method I use to read an XML file (actually, it is an Oracle Reports file converted to XML) and from the string version, I will do search, replace and other things.
So, from getGroupUsers which returns an XmlDataDocument, you can adapt this method to get your data server-side and let the form module read the output data.
<blockquote>
private String processFileXml(String fileName, int iFile) throws ParserConfigurationException, SAXException,
IOException, XPathExpressionException{
try{
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true);
InputStream inputStream = new FileInputStream(new File(fileName));
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse(inputStream);
StringWriter stw = new StringWriter();
Transformer serializer = TransformerFactory.newInstance().newTransformer();
serializer.transform(new DOMSource(doc), new StreamResult(stw));
return stw.toString();
catch (Exception e){
System.err.println(e);
System.exit(0);
return "OK";
</blockquote>
Let me know if this is of nay help.
Thanks. -
Is there any statement to transfer the data from unix server to another
Hi All,
Is there any statement or function module avaliable in sap to transfer the data from one unix server to another unix server apart from FTP(file transfer protocol).?
My requirement : I need to fetch the data from one unix server to another sap server. i have a option of FTP but i need to transfer the unix data to another server internal table.
I need to move the unix data to another sap sevrver internal table
Regards
Rajanot sure what your exact requirement is, but
if both servers are in the same system group, you could potentially just mount the unix directory from the source machine to the target with nfs mount or something.
if not, you could consider remote function call. create a remotable function module on the source machine to read the data into an internal table, and call that function module from the target machine. this requires creating entries in the RFCDES table (i think via SM59?). on the target machine, you would call function y_whatever destination xyz, where xyz is the RFCDES you set up. it works great.
dave -
Reading xml data from url and insert into table
CREATE TABLE url_tab2
URL_NAME VARCHAR2(100),
URL SYS.URIType
INSERT INTO url_tab2 VALUES
(’This is a test URL’,
sys.UriFactory.getUri(’http://www.domain.com/test.xml’)
it is giving error as invalid characterCheck if your single quotes are the correct single quotes.
The principle works as advertised in the XMLDB Developers Guide...
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Tue Nov 25 21:44:46 2008
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user OTN identified by OTN account unlock;
User created.
SQL> grant dba, xdbadmin to OTN;
Grant succeeded.
SQL> conn OTN/OTN
Connected.
SQL> CREATE TABLE uri_tab (docUrl SYS.URIType, docName VARCHAR2(200));
Table created.
SQL> -- Method SYS.URIFACTORY.getURI() with absolute URIs
SQL> -- Insert an HTTPUri with absolute URL into SYS.URIType using URIFACTORY.
SQL> -- The target is Oracle home page.
SQL> INSERT INTO uri_tab VALUES
2 (SYS.URIFACTORY.getURI('http://www.oracle.com'), 'AbsURL');
1 row created.
SQL> -- Insert an HTTPUri with relative URL using constructor SYS.HTTPURIType.
SQL> -- Note the absence of prefix http://. The target is the same.
SQL> INSERT INTO uri_tab VALUES (SYS.HTTPURIType('www.oracle.com'), 'RelURL');
1 row created.
SQL> -- Insert a DBUri that targets employee data from database table hr.employees.
SQL>
SQL> INSERT INTO uri_tab VALUES
2 (SYS.URIFACTORY.getURI('/oradb/HR/EMPLOYEES/ROW[EMPLOYEE_ID=200]'), 'Emp200');
1 row created.
SQL> SELECT e.docUrl.getCLOB(), docName FROM uri_tab e;
E.DOCURL.GETCLOB()
DOCNAME
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
<head>
AbsURL
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
E.DOCURL.GETCLOB()
DOCNAME
<head>
RelURL
<?xml version="1.0"?>
<ROW>
<EMPLOYEE_ID>200</EMPLOYEE_ID>
<FIRST_NAME>Jenn
Emp200
SQL> set long 1000
SQL> select HTTPURITYPE('www.oracle.com').getCLob() from dual;
HTTPURITYPE('WWW.ORACLE.COM').GETCLOB()
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
<head>
<title>Oracle 11g, Siebel, PeopleSoft |
Oracle, The World's Largest Enterprise S
oftware Company</title>
<meta name="title" content="Enterprise Applications | D
atabase | Fusion Middleware | Applicatio
ns Unlimited | Business | Oracle, The Wo
rld's Largest Enterprise Software CompanEdited by: Marco Gralike on Nov 25, 2008 10:13 PM -
Uploading data from a xlsx file into an Oracle table
Hi All,
I want to know what would be the best approach and tool to upload the data from an xlsx (excel) sheet into an Oracle table.
Can I use 'sqlldr'?
~ParagParag Kalra wrote:
What if the excel sheet is exported from some other third party database and not explicitly generated on Windows? I know if we can export it to excel why can't we also export it to csv but what if that option is also not available.
Also what things do I need to take into account when I export a xlsx file to csv file. I mean I hope in no circumstances there would be a data loss.How about instead of of these "what ifs" and "I hopes" you tell us exactly what you have to work with and describe the real business problem. If you ask the wrong questions, you get the wrong answers.
You "hope" that there would be no data loss? Do you really think Excel would survive as a product, much less be the overwhelming dominant product of its type, if it screwed up something that fundamental? The only thing that will be lost is the formatting meta-data. -
Uploading Data from a Flat file into Oracle Database
Hi,
I am a novice to Java . SO, please bear with me. I have a reqiurement where I have a flat file or excel file from which I need to read the data and insert into Oracle Database. The falt file will exist on the client machine. I have been reading and I see this can be done through I/O Streams. Correct me if I am wrong. I am looking for a sample code to get started. Any Java expert has an answer for it, I will appreciate it.
ThanksTry UploadBean. It allows to upload files (from a browser) in Oracle.
http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
You will find JSP and servlet samples. -
Hi to all,
I have flat files in different location through FTP i need to fetch those files and load in the relavant table of the database.
Please share me the query to do it ..You would need a ForEach Loop to iterate though the files. Initially the FTP task will pull the files from locations to a landing folder. Once thats done the ForEachLoop will iterate through files in the folder and will have a data flow task inside to transfer
file data to tables.
If you want a more secure option you can also use SFTP (Secured FTP) and can implement it using free WinSCP clinet. I've explained a method of doing it fo dynamic files here
http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
for iterating through files see this example
http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
you may not need the validation step inside the loop in your case
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Using Oracle Forms Importing Data From SQL Server into Oracle Tables.
Dear All,
We are using Oracle Forms 10g in windows XP and having OAS 10g and Oracle database 9i.
How can we import data from SQL Server 2005 into Oracle tables using Oracle Forms?
Thanks & Regards
EidyI have no idea what "Oracle Hetrogenius Services" is, so I can't help you with that, sorry.
SQL Developer might also assist you. SQL Developer can connect to SQL Server as well as Oracle and has some tools for migration. See the documentation for details:
http://download.oracle.com/docs/cd/E12151_01/doc.150/e12156/toc.htm
For additional help on using SQL Developer for this task, please consult Support or the SQL Developer forum: SQL Developer
Hope this helps,
Jacob -
How to Load Arabic Data from flat file using SQL Loader ?
Hi All,
We need to load Arabic data from an xls file to Oracle database, Request you to provide a very good note/step to achieve the same.
Below are the database parameters used
NLS_CHARACTERSET AR8ISO8859P6
nls_language american
DB version:-10g release 2
OS: rhel 5
Thanks in advance,
SatishTry to save your XLS file into CSV format and set either NLS_LANG to the right value or use SQL*Loader control file parameter CHARACTERSET.
See http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_control_file.htm#i1005287
Maybe you are looking for
-
Photoshop elements 11 download error
As soon as i type my country of residence and serial number in i receive a message saying that an error has occured with the download and that i must try again. please help. i have now retried a number of times without success. Thank you
-
What is the External Policy Check in SIM?
Hi all. Can anybody tell me what is the External Policy Check for resource in Sun Identity Manager? Sometimes, when I check the workflow status, I'm observing log entries like that: "Starting the External Policy Check on Resource Name' failed. " Is i
-
Elements 12 upgrade after new Mac OS is released?
I want to purchase Elements 12 for Mac which currently works with OS 10.7-10.9. Apple is coming out with a new operating system in the next few months. If I buy Elements 12 now, will Elements 12 work with that new OS, or will Adobe release an free
-
Hello, My new Thinkpad T400 has a strange problem. When I move the notebook (for example when transporting it, while it is running, or when I ride a train), it often occurs that my programs begin to quit responding; starting new ones is not possible.
-
CUP 5.3 Superuser Access Request Error
Dear Exparts, I have a path u201CSuperuser Access Requestu201D with three stages* for assigning FF IDs to requesting users in CUP. Stage1: Manager (Determinator: Manager) Stage2: Superuser Owner (Determinator: Superuser Owner) Stage3: Security Admin