Store xml files in the database like Microsoft Access
Dear friends,
I have come up here with a problem. I have to insert xml files in the database like Microsoft Access.
So would somebody help me out.
The query syntax to insert file and then retreive it back from database.
How would u do it with picture files?
I am waiting for your help.
Thanks in advance.
Yours Truly,
Khawaja Salman Sarfraz
Large files are usually stored as binary large objects (BLOBS.) I think MS Access calls these Memo fields.
Similar Messages
-
Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.The Oracle documentation has a good overview of the options available
Generating XML Data from the Database
Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
You can also find some information in XML DB FAQ -
Inset a XML file in the database
How to insert the XML file in the XML type field in the database?
This will work
INSERT INTO nonexistant_table
(xml_col)
VALUES
(XMLTYPE('<?xml version="1.0"?>
<rnode>
<cnode1>value</cnode1>
</rnode>')
);but without knowing what version you are on and what your requirements really are I can't say what other options are available to you. Just search this forum for INSERT, look at some of the methods that are being used to load XML into a table and then read up on the corresponding Oracle documentation. -
While inserting values from a xml file into the database.
Dear Forum Members,
While using Samp10.java (given in XSU!2_ver1_2_1/oracleXSU12/Sample)for inserting values from xml file Sampdoc.xml into database table xmltest_tab1,the error shown below appears on the DOS prompt.
The code for sam10 is:
import oracle.xml.sql.dml.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.jdbc.*;
import java.net.*;
public class samp10
public static void main(String args[]) throws SQLException
String tabName = "xmltest_tab1";
String fileName = "sampdoc.xml";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:BookingSealinerScott","scott","tiger");
OracleXMLSave sav = new OracleXMLSave(conn, tabName);
URL url = sav.createURL(fileName);
int rowCount = sav.insertXML(url);
System.out.println(" successfully inserted "+rowCount+
" rows into "+ tabName);
conn.close();
}catch (Exception e){e.printStackTrace();}
The Structure of Sampdoc.xml is:
<?xml version="1.0"?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
</ROW>
<ROW num="2">
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
</ROW>
<ROW num="3">
<EMPNO>7521</EMPNO>
<ENAME>WARD</ENAME>
<JOB>SALESMAN</JOB>
</ROW>
</ROWSET>
Description of table xmltest_tab1 is:
SQL> desc xmltest_tab1;
Name Null? Type
EMPNO NUMBER(4)
ENAME CHAR(10)
JOB VARCHAR2(9)
Error Displayed is:
A nonfatal internal JIT (3.00.078(x)) error 'Structured Exception(c0000005)' has
occurred in :
'oracle/xml/sql/dml/OracleXMLSave.cleanLobList ()V': Interpreting method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi
oracle.xml.sql.OracleXMLSQLException: sun.jdbc.odbc.JdbcOdbcConnection
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1967)
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1880)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1013)
at samp10.main(samp10.java:36)
Press any key to continue . . .
Please send me the solution as soon as possible.
Thanks,
Waiting for your Reply,
Bye,
Vineet Choudhary
Email id: [email protected]
nullGo and read about JDBC. You need to know some basics before asking such a st&*id questions.
Paul -
How to load a XML file into the database
Hi,
I've always only loaded data into the database by using SQL-Loader and the data format was Excel or ASCII
Now I have to load a XML.
How can I do?
The company where I work has Oracle vers. 8i (don't laugh, please)
Thanks in advance!Hi,
Tough job especially if the XML data is complex. The have been some similar question in the forum:
Using SQL Loader to load an XML File -- use 1 field's data for many records
SQL Loader to upload XML file
Hope they help.
Regards,
Sujoy -
Performance problems loading an XML file into oracle database
Hello ODI Guru's,
I am trying to load and XML file into the database after doing simple business validations. But the interface takes hours to complete.
1. The XML files are large in size >200 Mb. We have an XSD file for the schema definition instead of a DTD.
2. We used the external database feature for loading these files in database.
The following configuration was used in the XML Data Server:
jdbc:snps:xml?f=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xml&d=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xsd&re=initialLoad&s=CM&db_props=oracle&ro=true
3. Now we reverse engineer the XML files and created models using ODI Designer
4. Similar thing was done for the target i.e. an Oracle database table as well.
5. Next we created a simple interface with one-to-one mapping from the XSD schema to the Oracle database table and executed the interface. This execution takes more than one hour to complete.
6. We are running ODI client on Windows XP Professional SP2.
7. The Oracle database server(Oracle 10g 10.2.0.3) for the target schema as well as the ODI master and work repositories are on the same machine.
8. I tried changing the following properties but it is not making much visible difference:
use_prepared_statements=Y
use_batch_update=Y
batch_update_size=510
commit_periodically=Y
num_inserts_before_commit=30000
I have another problem that when I set batch_update_size to value greater that 510 I get the following error:
java.sql.SQLException: class org.xml.sax.SAXException
class java.lang.ArrayIndexOutOfBoundsException said -32413
at com.sunopsis.jdbc.driver.xml.v.a(v.java)
The main concern is why should the interface taking so long to execute.
Please send suggestions to resolve the problem.
Thanks in advance,
Best Regards,
NikunjApproximately how many rows are you trying to insert?
One of the techniques which I found improved performance for this scenario was to extract from the xml to a flat file, then to use SQL*LOADER or external tables to load the data into Oracle. -
Saving xml files in oracle database
hi all
anyone who could tell me how can i save xml files in the database?In order to provide an intelligent answer we need much more information. Please describe the problem you are trying to solve in more detail. The kind of information that would help is
Database Version ?
What is the source of the XML Files ?
What is the size of the Files ?
How are they stored prior to wanting to load them into the database, on the database server or on a client ?
What is you preferred programming language ?
What kind of querys to do you want to run against the files once they are stored in the database ?
Note if your database version is pre 9i then the question can be better answered in the forum Technologies -> XML -> General
I can move you post there if appropriate -
Load XML file into oracle database
Hi
i have a xml file and the XSD(Schema definition file for XML). i need to load the xml file into the database.
Can you please tell me the best approach for this ?There are plenty of examples of this on the XML DB Forum.
Here is a link to the FAQ for that forum...
XML DB FAQ -
How to Store PDF files In the Oracle Database?
Hi All,
It is required for me to store the PDF files in the Database and retrieve it back whenever necessary.
Also I need to store it with some security. So no one can read the content of the file.
Please give me solution to these problems.
Thanksvasav wrote:
Hi All,
It is required for me to store the PDF files in the Database and retrieve it back whenever necessary.Why not save the files to disk and store a link to the file in the database instead?
Also I need to store it with some security. So no one can read the content of the file.Authenticate users requesting files.
Please give me solution to these problems.There are many possible solutions for your requirements. -
Store and Display doc/pdf files in the database using Forms
Hi all,
How can i store and display doc/pdf files in the database using Forms 10g?.
ArifHow to get up and running with WebUtil 1.06 included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform
Solution
Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
here are steps to get a small test form running, using WebUtil 1.06.
Note: [OraHome] is used as an alias for your real oDS ORACLE_HOME.
Feel free to copy this note to a text editor, and do a global find/replace on
[OraHome] with your actual value (no trailing slash). Then it is easy to
copy/paste actual commands to be executed from the note copy.
1) Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip
and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
2) Copy or move jacob.jar and jacob.dll
[JacobStage] is the folder where you extracted Jacob, and will end in ...\jacob_18
cd [JacobStage]
copy jacob.jar [OraHome]\forms\java\.
copy jacob.dll [OraHome]\forms\webutil\.
The Jacob staging area is no longer needed, and may be deleted.
3) Sign frmwebutil.jar and jacob.jar
Open a DOS command prompt.
Add [OraHome]\jdk\bin to the PATH:
set PATH=[OraHome]\jdk\bin;%PATH%
Sign the files, and check the output for success:
[OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\frmwebutil.jar
[OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\jacob.jar
4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
you may skip this step. Otherwise,
Create a schema to hold the WebUtil stored code, and privileges needed to
connect and create a stored package. Schema name "WEBUTIL" is recommended
for no reason other than consistency over the user base.
Open [OraHome]\forms\create_webutil_db.sql in a text editor, and delete or comment
out the EXIT statement, to be able to see whether the objects were created witout
errors.
Start SQL*Plus as SYSTEM, and issue:
CREATE USER webutil IDENTIFIED BY [password]
DEFAULT TABLESPACE users
TEMPORARY TABLESPACE temp;
GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
CONNECT webutil/[password]@[connectstring]
@[OraHome]\forms\create_webutil_db.sql
-- Inspect SQL*Plus output for errors, and then
CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
Reconnect as SYSTEM, and issue:
grant execute on webutil_db to public;
5) Modify [OraHome]\forms\server\default.env, and append [OraHome]\jdk\jre\lib\rt.jar
to the CLASSPATH entry.
6) Start the OC4J instance
7) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
Open webutil.pll, do a "Compile ALL" (shift-Control-K), and generate to PLX (Control-T).
It is important to generate the PLX, to avoid the FRM-40039 discussed in
Note 303682.1
If the PLX is not generated, the Webutil.pll library would have to be attached with
full path information to all forms wishing to use WebUtil. This is NOT recommended.
8) Create a new FMB.
Open webutil.olb, and Subclass (not Copy) the Webutil object to the form.
There is no need to Subclass the WebutilConfig object.
Attach the Webutil.pll Library, and remove the path.
Add an ON-LOGON trigger with the code
NULL;
to avoid having to connect to an RDBMS (optional).
Create a new button on a new canvas, with the code
show_webutil_information (TRUE);
in a WHEN-BUTTON-PRESSED trigger.
Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K).
9) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
the "Application Server URL" is empty.
Then append "?config=webutil" at the end, so you end up with a URL of the form
http://server:port/forms/frmservlet?config=webutil
10) Run your form.sarah -
Which is better? store files in the database or directly on the O.S.?
Hi,
i´m developing an application to manager files. which is better? store files in the database or directly on the O.S.? If i decide to store on database, i will use the BLOB data type but i have a doubt...the BLOB data type occupies the same space on database regardless of file size? there is another data type better?
Tks,
Fernando.http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1011065100346196442
Ask Tom has a bit of info to share on the topic. Have a read of this. :) -
Insert XML file into Relational database model without using XMLTYPE tables
Dear all,
How can I store a known complex XML file into an existing relational database WITHOUT using xmltypes in the database ?
I read the article on DBMS_XMLSTORE. DBMS_XMLSTORE indeed partially bridges the gap between XML and RDBMS to a certain extent, namely for simply structured XML (canonical structure) and simple tables.
However, when the XML structure will become arbitrary and rapidly evolving, surely there must be a way to map XML to a relational model more flexibly.
We work in a java/Oracle10 environment that receives very large XML documents from an independent data management source. These files comply with an XML schema. That is all we know. Still, all these data must be inserted/updated daily in an existing relational model. Quite an assignment isn't it ?
The database does and will not contain XMLTYPES, only plain RDBMS tables.
Are you aware of a framework/product or tool to do what DBMS_XMLSTORE does but with any format of XML file ? If not, I am doomed.
Constraints : Input via XML files defined by third party
Storage : relational database model with hundreds of tables and thousands of existing queries that can not be touched. The model must not be altered.
Target : get this XML into the database on a daily basis via an automated process.
Cheers.
Luc.Luc,
your Doomed !
If you would try something like DBMS_XMLSTORE, you probably would be into serious performance problems in your case, very fast, and it would be very difficult to manage.
If you would use a little bit of XMLType stuff, you would be able to shred the data into the relational model very fast and controlable. Take it from me, I am one of those old geezers like Mr. Tom Kyte way beyond 40 years (still joking). No seriously. I started out as a classical PL/SQL, Forms Guy that switched after two years to become a "DBA 1.0" and Mr Codd and Mr Date were for years my biggest hero's. I have the utmost respect for Mr. Tom Kyte for all his efforts for bringing the concepts manual into the development world. Just to name some off the names that influenced me. But you will have to work with UNSTRUCTURED data (as Mr Date would call it). 80% of the data out there exists off it. Stuff like XMLTABLE and XML VIEWs bridge the gap between that unstructured world and the relational world. It is very doable to drag and drop an XML file into the XMLDB database into a XMLtype table and or for instance via FTP. From that point on it is in the database. From there you could move into relational tables via XMLTABLE methods or XML Views.
You could see the described method as a filtering option so XML can be transformed into relational data. If you don't want any XML in your current database, then create an small Oracle database with XML DB installed (if doable 11.1.0.7 regarding the best performance --> all the new fast optimizer stuff etc). Use that database as a staging area that does all the XML shredding for you into relational components and ship the end result via database links and or materialized views or other probably known methodes into your relational database that isn't allowed to have XMLType.
This way you would keep your realtional Oracle database clean and have the Oracle XML DB staging database do all the filtering and shredding into relational components.
Throwing the XML DB option out off the window beforehand would be like replacing your Mercedes with a bicycle. With both you will be able to travel the distance from Paris to Rome, but it will take you a hell of lot longer.
:-) -
Approach to parse large number of XML files into the relational table.
We are exploring the option of XML DB for processing a large number of files coming same day.
The objective is to parse the XML file and store in multiple relational tables. Once in relational table we do not care about the XML file.
The file can not be stored on the file server and need to be stored in a table before parsing due to security issues. A third party system will send the file and will store it in the XML DB.
File size can be between 1MB to 50MB and high performance is very much expected other wise the solution will be tossed.
Although we do not have XSD, the XML file is well structured. We are on 11g Release 2.
Based on the reading this is what my approach.
1. CREATE TABLE XML_DATA
(xml_col XMLTYPE)
XMLTYPE xml_col STORE AS SECUREFILE BINARY XML;
2. Third party will store the data in XML_DATA table.
3. Create XMLINDEX on the unique XML element
4. Create views on XMLTYPE
CREATE OR REPLACE FORCE VIEW V_XML_DATA(
Stype,
Mtype,
MNAME,
OIDT
AS
SELECT x."Stype",
x."Mtype",
x."Mname",
x."OIDT"
FROM data_table t,
XMLTABLE (
'/SectionMain'
PASSING t.data
COLUMNS Stype VARCHAR2 (30) PATH 'Stype',
Mtype VARCHAR2 (3) PATH 'Mtype',
MNAME VARCHAR2 (30) PATH 'MNAME',
OIDT VARCHAR2 (30) PATH 'OID') x;
5. Bulk load the parse data in the staging table based on the index column.
Please comment on the above approach any suggestion that can improve the performance.
Thanks
AnuragTThanks for your response. It givies more confidence.
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
TNS for Linux: Version 11.2.0.3.0 - Production
Example XML
<SectionMain>
<SectionState>Closed</SectionState>
<FunctionalState>CP FINISHED</FunctionalState>
<CreatedTime>2012-08</CreatedTime>
<Number>106</Number>
<SectionType>Reel</SectionType>
<MachineType>CP</MachineType>
<MachineName>CP_225</MachineName>
<OID>99dd48cf-fd1b-46cf-9983-0026c04963d2</OID>
</SectionMain>
<SectionEvent>
<SectionOID>99dd48cf-2</SectionOID>
<EventName>CP.CP_225.Shredder</EventName>
<OID>b3dd48cf-532d-4126-92d2</OID>
</SectionEvent>
<SectionAddData>
<SectionOID>99dd48cf2</SectionOID>
<AttributeName>ReelVersion</AttributeName>
<AttributeValue>4</AttributeValue>
<OID>b3dd48cf</OID>
</SectionAddData>
- <SectionAddData>
<SectionOID>99dd48cf-fd1b-46cf-9983</SectionOID>
<AttributeName>ReelNr</AttributeName>
<AttributeValue>38</AttributeValue>
<OID>b3dd48cf</OID>
<BNCounter>
<SectionID>99dd48cf-fd1b-46cf-9983-0026c04963d2</SectionID>
<Run>CPFirstRun</Run>
<SortingClass>84</SortingClass>
<OutputStacker>D2</OutputStacker>
<BNCounter>54605</BNCounter>
</BNCounter>
I was not aware of Virtual column but looks like we can use it and avoid creating views by just inserting directly into
the staging table using virtual column.
Suppose OID id is the unique identifier of each XML FILE and I created virtual column
CREATE TABLE po_Virtual OF XMLTYPE
XMLTYPE STORE AS BINARY XML
VIRTUAL COLUMNS
(OID_1 AS (XMLCAST(XMLQUERY('/SectionMain/OID'
PASSING OBJECT_VALUE RETURNING CONTENT)
AS VARCHAR2(30))));
1. My question is how then I will write this query by NOT USING COLMUN XML_COL
SELECT x."SECTIONTYPE",
x."MACHINETYPE",
x."MACHINENAME",
x."OIDT"
FROM po_Virtual t,
XMLTABLE (
'/SectionMain'
PASSING t.xml_col <--WHAT WILL PASSING HERE SINCE NO XML_COL
COLUMNS SectionType VARCHAR2 (30) PATH 'SectionType',
MachineType VARCHAR2 (3) PATH 'MachineType',
MachineName VARCHAR2 (30) PATH 'MachineName',
OIDT VARCHAR2 (30) PATH 'OID') x;
2. Insetead of creating the view then Can I do
insert into STAGING_table_yyy ( col1 ,col2,col3,col4,
SELECT x."SECTIONTYPE",
x."MACHINETYPE",
x."MACHINENAME",
x."OIDT"
FROM xml_data t,
XMLTABLE (
'/SectionMain'
PASSING t.xml_col <--WHAT WILL PASSING HERE SINCE NO XML_COL
COLUMNS SectionType VARCHAR2 (30) PATH 'SectionType',
MachineType VARCHAR2 (3) PATH 'MachineType',
MachineName VARCHAR2 (30) PATH 'MachineName',
OIDT VARCHAR2 (30) PATH 'OID') x
where oid_1 = '99dd48cf-fd1b-46cf-9983';<--VIRTUAL COLUMN
insert into STAGING_table_yyy ( col1 ,col2,col3
SELECT x."SectionOID",
x."EventName",
x."OIDT"
FROM xml_data t,
XMLTABLE (
'/SectionMain'
PASSING t.xml_col <--WHAT WILL PASSING HERE SINCE NO XML_COL
COLUMNS SectionOID PATH 'SectionOID',
EventName VARCHAR2 (30) PATH 'EventName',
OID VARCHAR2 (30) PATH 'OID',
) x
where oid_1 = '99dd48cf-fd1b-46cf-9983';<--VIRTUAL COLUMN
Same insert for other tables usind the OID_1 virtual coulmn
3. Finaly Once done how can I delete the XML document from XML.
If I am using virtual column then I beleive it will be easy
DELETE table po_Virtual where oid_1 = '99dd48cf-fd1b-46cf-9983';
But in case we can not use the Virtual column how we can delete the data
Thanks in advance
AnuragT -
Pulling a PDF file from the database
How would I display a pdf file from the database, or should I convert it to an image and if so how do I convert it into an image?
Hi Phil_Kenya,
Some samples here:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/db1556be-0f71-41cb-92de-b95f1e1ca3a3/how-can-i-load-a-pdf-file-in-my-database-filemdf-in-aspnet-web-project?forum=csharpgeneral
http://stackoverflow.com/questions/7747796/displaying-pdf-files-in-a-web-page-from-a-sql-database-directly-without-needing
I suggest you post this issue to the language development forum like above case, I think you would get more dedicated support.
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Where can I find an example of a vi which reads a xml file using the Labview schema (LVXMLSchema.xsd)?
�Unflatten From XML� is of little use in parsing because it requires the data type. So it seems that the user has to parse each data value, and then �Unflatten From XML� can help a little.
I would like to see NI provide a VI for parsing it�s own schema.LabVIEW's XML functions are another way of saving data from controls and indicators that is in a more standardized format. If you look at the Unflatten From XML shipping example, it shows taking the data that you would normally send to a Digital Wveform Graph and converting it to XML instead. This data is then unflattend from XML and wired to the graph. Since you know what you wrote to the file, this is an easy thing to do. If what you are looking for is a way to look at any data in any LabVIEW XML file, then you are right, there is not a VI for that. However, I do not believe that that was the intention of the XML functions in the first place.
By wiriting data in XML, this allows other applications outside of LabVIEW to parse and recognize the dat
a. In LabVIEW, you would already know the types and can place a generic item of that type. The issue of knowing the type is that you need to know the type of the wire that comes out of the Unflatten function so that the VI will compile correctly. You could always choose a variant value to unflatten and then do some parsing to take the variant a part. Maybe this will help you out.
See this example for using the Microsoft parser for XML. (http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CB9FE111EE034080020E74861&p_node=DZ52050&p_submitted=N&p_rank=&p_answer=)
Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
Maybe you are looking for
-
I can load CS3, but it won't let me register it and I can load CS5 upgrade, but when I open CS5 it shows fault and closes. What can I do to get these programs to work on my new computer?
-
I am not able do download any apps from my app, be it paid or free. I don't see an icon for eg FREE to download an app. I just upgraded to i07 0.2, pls guide if there is some miss in setting..
-
"Invalid Annotation Object" error
I'm using Windows XP Pro (SP3) on a 2.66 GHz, 2 GB RAM computer, and while working in an Adobe Acrobat 9 document, I had just saved the file (CTRL+S) and the document froze and I got a Windows error box that asked if I wanted to send an error report,
-
Security deposit - not received?
HOW DO I CHECK TO SEE IF I HAVE RECEIVED MY SECURITY DEPOSIT. I WAS TOLD BY YOUR OFFICE THAT IT WAS RETURED. I ASKED FOR PROOF AND WAS TOLD IT WOULD TAKE A COUPLE OF WEEKS. IT HAS BEEN OVER TWO MONTHS NOW. HELP!!!!! <Branched to a new discussion.> M
-
Someone please tell me why Itunes will no longer scroll thru unchecked tracks? Why do great things have to be changed to suck now? I used to use a remote and the unchecked tracks would pause after each track. GREAT! PERFECT! Then it's got to be messe