XML to table mapping in oracle database
Hi,
I am having 2 modules in my application:
First module takes the XML file, parse it, fetches data, creates a table in database and stores the data into that table.
Second module does vice versa. it takes a table, retrives data and write out an XML file.
In first module I use DOM parser. But I want to use Oracle XSU for the second module. But it seems that I can not use oracle XSU and DOM togather.
when I include xmlparserv2.jar in class path I can not run my first module.
Is it possible that I can use dom for first module and XSU for second module?
It gives me error like ..
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/XMLText
at oracle.xml.parser.v2.NonValidatingParser.<init>(NonValidatingParser.java:139)
at oracle.xml.parser.v2.XMLParser.<init>(XMLParser.java:122)
at oracle.xml.parser.v2.DOMParser.<init>(DOMParser.java:82)
at oracle.xml.jaxp.JXDocumentBuilder.<init>(JXDocumentBuilder.java:71)
at oracle.xml.jaxp.JXDocumentBuilderFactory.newDocumentBuilder(JXDocumentBuilderFactory.java:72)
BUT if I remove xmlparserv2.jar from classpath then it works fine...
I would really appreciate if anyone can throw light ...
Thanks in advance
rp
Hi,
I had somewhat a similar problem.
Did you use oracle.xdb.XMLType.getDOM()?
getDOM() needs xmlparserv2.jar, which only provides a DOM implementation that is DOM 1.0 and Core 2.0 compliant.
In my case, when I used DOM 3.0 methods in org.w3c.dom, I ran into the "method not found" type of error.
My solution was to use the DocumentBuilder that comes with the JDK to create the DOM instance in the code.
P.
Similar Messages
-
How to import a table from another oracle database ?
Hi all ,
i could like to use pl/sql to import one table from another oracle database server ?
is it possible to do this ?
A server B server
table: test <------------------------> table : newtest
the tns profile already configurated . the connection is ready .
thanks a lot !
Best Regards,
Carlosif i don't have TEST table on server B whether COPY command will create this table on server B with the same structure ? If you specify CREATE as a clause the table will be created:
SQL> help copy
COPY
COPY copies data from a query to a table in a local or remote
database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
COPY {FROM database | TO database | FROM database TO database}
APPENDCREATE|INSERT|REPLACE} destination_table
[(column, column, column, ...)] USING query
where database has the following syntax:
username[password]@connect_identifier -
Internal Behaviour of Truncate Table Command in Oracle Database
Hi,
Can anyone let me know the internal behaviour of Truncate Table Command in Oracle Database?
Thanks,
Harshad.Hi Tuhinshoor,
I know the functioning of Truncate Command.
But, I needed to know whether it drops the table before recreating it, maintaining all the indexes and constraints intact??
Thanks,
Harshad. -
Convert flat file to XML document and store into Oracle database
First:
I have a flatfile and created external table to read that file in Oracle
Now I want to create an XML document for each row and insert into Oracle database, I think that XMLtype.
Could you please provide me some information/steps.
Second:
Is there performance issues, because everyday I need to check that XML document stored in the database against the in coming file.
Thank You.Oracle 11g R2 Sun Solaris
Flat file is | (pipe delimited), so I did create an EXTERNAL Table
row1 a|1|2|3|4
row2 b|2|3|4|5
row3 c|6|7|8|9
I want to store each record as XML document. So it will be easy to compare with next day's load and make insert or update.
The reason is:
First day the file comes with 5 columns
after some days, the file may carry on some additional columns more than 5
In this case I do not want to alter table to capture those values, if I use XML than I can capture any number of columns, CORRECT!. Please make me correct If I am wrong.
This is the only reason to try to use the XMLType (XML Document)
On Everyday load we will be matching these XML documents and update it if there is any column's value changes
daily average load will be 10 millions and initial setup will be 60-80 millions
Do I have anyother option to capture the new values without altering the table.
Please advise!. -
Auto Increment ID Field Table in the Oracle Database (insert new record)
I have been using the MySQL. And the ID field of the database table is AUTO INCREMENT. When I insert a new record into a database table, I can have a statement like:
public void createThread( String receiver, String sender, String title,
String lastPostMemberName, String threadTopic,
String threadBody, Timestamp threadCreationDate,
Timestamp threadLastPostDate, int threadType,
int threadOption, int threadStatus, int threadViewCount,
int threadReplyCount, int threadDuration )
throws MessageDAOSysExceptionand I do not have to put the ID variable in the above method. The table will give the new record an ID number that is equivalent to the ID number of the last record plus one automatically.
Now, I am inserting a new record into an Oracle database table. I am told that I cannot do what I am used to doing with the MySQL database.
How do I revise the createThread method while I have no idea about what the next sequence number shall be?I am still very confused; in particular, the Java part. Let me try again.
// This part is for the database table creation
-- Component primary key sequence
CREATE SEQUENCE dhsinfo_page_content_seq
START WITH 0;
-- Trigger for updating the Component primary key
CREATE OR REPLACE TRIGGER DHSInfoPageContent_INSERT_TRIGGER
BEFORE INSERT ON DHSInfoPageContent //DHSInfoPageContent is the table name
FOR EACH ROW WHEN (new.ID IS NULL) // ID is the column name for auto increment
BEGIN
SELECT dhsinfo_page_content_seq.Nextval
INTO :ID
FROM DUAL;
END;/I am uncertain what to do with my Java code. (I have been working with the MySQL. Changing to the Oracle makes me very confused.
public void updateContent( int groupID, String pageName, int componentID,
String content, Timestamp contentCreationDate )
throws contentDAOSysException
// The above Java statement does not have a value to insert into the ID column
// in the DHSInfoPageContent table
Connection conn = null;
PreparedStatement stmt = null;
// what to do with the INSERT INTO below. Note the paramether ID.
String insertSQL = "INSERT INTO DHSInfoPageContent( ID, GroupID, Name, ComponentID, Content, CreationDate ) VALUES (?, ?, ?, ?, ?, ?)";
try
conn = DBConnection.getDBConnection();
stmt = conn.prepareStatement( insertSQL );
stmt.setInt( 1, id ); // Is this Java statement redundant?
stmt.setInt( 2, groupID );
stmt.setString( 3, pageName );
stmt.setInt( 4, componentID );
stmt.setString( 5, content );
stmt.setTimestamp( 6, contentCreationDate );
stmt.executeUpdate();
catch
finally -
Can't access tables in other Oracle database schemas
Hi. We got our Oracle database admin to install APEX in our Oracle database. She created a login and schema for my Oracle database user so that I could work with APEX a little. Here's the information on the version of APEX we have installed:
Database Version Information
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I've found that my user is only able to access Oracle tables within my own Oracle database schema. Most of our main tables are in 3 other schemas and I'd need access to all tables in all these schemas. Right now whenever I encounter a drop list of values for Schema, only by own schema is available in the list of values.
Is there something our Admin can do to make these tables in other schemas available to my user account?Sharpe,
This documentation should point you in the right direction. It will show you how to add multiple schemas to a workspace.
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21678/adm_mg_wrkspc.htm#CHDBDCCJ
Cheers,
Tyson Jouglet -
Xml Data into Table Within an Oracle Database
With no oracle or database background, I have been tasked to figure out how to analyze reading values within xml files. I initially started by writing c# code to read through the xml files, pull out the values I need and summarize the results. Unfortunately, this took atleast 5 hours to open all the xml files and summarize the results for a small portion of EndPointChannelId's and xml files. I decided to store all the reading values within the xml files into a table so I can use SQL queries to do the analysis instead of having to process through all the files each time. Using the same c# code as before, I have used insert and update sql statements to insert the reading values into a table. To my dismay, it takes about 3 and a half hours to import 1 file where there is 20 files a day :S. There are over 19,000 ChannelID's per file. I am currently using SQL Developer to view the data and have noticed XML Schemas and XML DB Repository but am not sure if that would be the best approach to my problem. I need to increase the efficiency of the import process but I am having difficulties trying to figure out how to go about it. Do you have any suggestions on where I should go from here? What is the most efficient way you have used to import xml files into a table structure. I would greatly appreciate any ideas!
Below is a portion of the xml file that I am working with.
- <Channel ReadingsInPulse="false" IsRegister="false" IsReadingDecoded="true" MarketType="Electric" IntervalLength="60">
<ChannelID EndPointChannelID="57432:1" />
- <ContiguousIntervalSets>
- <ContiguousIntervalSet NumberOfReadings="6">
<TimePeriod EndRead="22467.80" EndTime="2013-05-09T13:00:00Z" StartTime="2013-05-09T07:00:00Z" />
- <Readings>
<Reading Value="0.31" />
<Reading Value="0.4" />
<Reading Value="0.16" />
<Reading Value="0.32" />
<Reading Value="0.09" />
<Reading Value="0.35" />
</Readings>
</ContiguousIntervalSet>
</ContiguousIntervalSets>
</Channel>Hi,
Welcome to the forums,
what i understand from your Post, You want to read/analyze some value from xml files. and for this you want to import it in database and then perform some Query on that file for easy work.
you can choose the External table concept for reading/ Query those files
check this link may it help you
Creation of External table by using XML files.
http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables013.htm -
Cannot access columns in a result set using table alias in Oracle database
I have a query which joins a few tables. There are a few columns in various tables with identical names. In the query, I have assigned table aliases for each table thinking it'll be the manner in which I access a specific column in a specific database table. However, when trying to retrieve the column, I'm getting an exception stating "Invalid column name". I had no problem doing so in my last project when I was coding against MySQL database so this is likely to be a driver implementation issue. My current workaround is to assign a column alias though I find this to be annoying and it does make the query very verbose.
My question is whether this option is perhaps a configuration issue, a bug, or something that I'm missing. Also, I would like to know if anybody has an elegant workaround without accessing columns using their numeric index.
I'm querying an Oracle 10i database in a managed environment (database connection is obtained from a Weblogic data source).
Sample query:
select
a.address1,
d.address1
from
account a
inner join
department d on a.department_id = d.department_id
where
a.account_id = 1000;
When trying to access a ResultSet instance in the following manner, I will get an exception:
rs.getString("d.address1");
Retrieving "address1" will return the first column in the select clause.jonathan3 wrote:
My question is whether this option is perhaps a configuration issue, a bug, or something that I'm missing. Since you already figured out that you can use an alias one can suppose that it is the last in that you are missing that you already have a solution.
You can try extracting the meta data to see if it has a name without the alias. Probably not.
Also, I would like to know if anybody has an elegant workaround without accessing columns using their numeric index.One can only suppose that you consider using names "elegant". -
Putting Partition in tables in the Oracle database
How do I create partitions in the various SAP datases running on Oracle?
Hi,
I'm sorry to say you've reached the wrong forum, as this one's for MaxDB and liveCache only. I'll try to find a more suited one.
Can you maybe tell us which:
- SAP Application plattform (Netweaver, BI ...) you are using?
- operating system (OS) your Oracle DB is running on?
Regards,
Roland -
Data extraction into sap table from legacy oracle database
Hello All,
I have a scenario where I have two different software systems (SAP and xyz systems), where a intermediate table will be created in between the two systems that is shared. Data will be updated by the xyz systems into this shared table. Now, my questions regarding this shared table.
1) Can we write some program or something to get the data from shared table to update the SAP?
2) If possible send me the suggestions
3) Please also send me the sample code to get the data from the shared table
Thanks in advance,
SDN poweredthis shared table should be compatiable to sap fields...write code to fetch data from this table and assign data to appropriate fields in SAP and insert the data into sap.
1. Push mechanism
Write a RFC on SAP side to insert entries into the table.
Call the RFC from xyz application passing the data you want to insert.
2. Pull mechanism
Write a ABAP Program, where you can somehow read the data of the xyz application and insert data into the table.
3. Flat file
Dump the data from xyz application into the file.
Write a ABAP program to read the file and update the table. -
Loading XML files to an oracle database
Hi,
I have some users who would like to send me XML files that I would need to parse and load into multiple tables in my Oracle database. Since I'm new to XML, I'd like to know if XMK DB is the technology that I need to explore in order to do this, and if so, are there any white papers or articles out there that might get me started.
I have previously loaded data into my databases via text files that I parsed using text_io, I'm not sure if there is a significant advantage in using XML. This data load is going to be on an regular basis and I would like to validate the data the data before loading this.
Any help or guidance would be greatly appreciated.
Thanks.
Azeem.XML is becoming the defacto method of exchanging data between systems due to it's self describing nature. XML DB is the preferred way of processing XML in Oracle 9iR2 and later. The banner for this forum provides links to the XML DB OTN pages where you can find lots of information related to using XML DB.
-
Hi All,
This is regarding the Tab table in the oracle database.
When I query this Tab table using a database account I cannot see some of the tables in it, where as using another database accout I can see all those tables.
Any idea why?both user own different tables.
Defination of TAB view is below
1* select owner,text from dba_views where view_name='TAB'
OWNER TEXT
SYS select o.name,
decode(o.type#, 2, 'TABLE', 3, 'CL
USTER',
4, 'VIEW', 5, 'SYNONYM'), t
.tab#
from sys.tab$ t, sys."_CURRENT_EDITIO
N_OBJ" o
where o.owner# = userenv('SCHEMAID')
and o.type# >=2
and o.type# <=5
and o.linkname is null
and o.obj# = t.obj# (+)
it showing user tables detail
SQL> sho user
USER is "SCOTT"
SQL>
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
EMP2 TABLE
T6 TABLE
T3 TABLE
EMP1 TABLE
EMP1_TEMP TABLE
T$1 TABLE
T$2 TABLE
TEST TABLE
TT TABLE
BULK TABLE
14 rows selected.
SQL> select table_name from user_tables;
TABLE_NAME
DEPT
EMP
BONUS
SALGRADE
EMP2
T6
T3
EMP1_TEMP
T$1
T$2
TEST
TT
BULK
EMP1
14 rows selected.
SQL>
SQL>
SQL>
SQL> create table tst(no number);
Table created.
SQL> select table_name from user_tables;
TABLE_NAME
DEPT
EMP
BONUS
SALGRADE
EMP2
T6
T3
EMP1_TEMP
T$1
T$2
TST
TEST
TT
BULK
EMP1
15 rows selected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
EMP2 TABLE
T6 TABLE
T3 TABLE
EMP1 TABLE
EMP1_TEMP TABLE
T$1 TABLE
T$2 TABLE
TST TABLE
TEST TABLE
TT TABLE
BULK TABLE
15 rows selected. -
Generate XML Schema from Oracle Database
Is there a utility that would allow our team to generate XML Schemas directly from existing Oracle databases? Or do you have a suggestion on how to achieve this?
Thank you.Hey, The Schema Processor is available in the Technologies section on this site. Just download it and see the samples. You will get the way for doing it. If you are having problems then just call me.
Bye.
null -
How to declare the namespace of XML document to use in oracle DB?
I have an XML Schema file( 'Hospital.xsd' ) that reference the XML document ('Hospitals.xml' ).
That I use JDeveloper to build them up.
JDeveloper had set the default namespace as 'http://www.example.org'
like this :
<?xml version="1.0" encoding="UTF-8" ?>
<Hospitals xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org src/Hospital.xsd"
xmlns="http://www.example.org">
If I want these two files ('Hospital.xsd' and 'Hospitals.xml') placed into
the table in the oracle database.
1. Should I create two tables? one for XSD and another for XML.
2. Should I keep the XSD file in the oracle database?
3. What is the namespace to declare in the heading of XML file?
The database name or my website URL?
Thank you very much.
Kanokporn P.Sounds a lot like this question, only with less details.
how to read data from XML variable and insert into table variable
We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us. Plenty of examples abound on the forums that cover the topics you seek as well. -
Connect to a oracle database in another server
Hi people,
I have to read some tables on a oracle database in another server.
I know that I will have to use EXEC SQL command, but how can I make the connection between SAP and that oracle database.
I have seen something about the DBCON table, but I am not sure if I can connect on another server from ther and how...
Thanks...Dear,
Check the below links:
http://sap.ittoolbox.com/groups/technical-functional/sap-basis/connection-between-sap-system-with-external-oracle-database-with-tcode-dbco-1178583
http://help.sap.com/saphelp_nwpi71/helpdata/en/df/455ec9747111d6b25100508b6b8a93/content.htm
Hope it will help you.
Regards,
Alok Tiwari
Maybe you are looking for
-
External Toshiba drive won't work on Mac after using on PC
My Toshiba External USB drive stopped working on my Mac air after I downloaded some files on a PC. It worked numerous times on the PC and then I brought it back home to use on Mac. Now, it won't show up on finder but can be found on Disk utility. I c
-
Netweaver 2004s on Solaris 10 (x64) - Starting SAP after server restart?
I have a Netweaver System running on Solaris\Oracle. Is there a guide or any general information on how to make the SAP System and all necessary components automatically start up? Right now, after a reboot, I have to log in as my oracle user to start
-
Centering a region in the page
Hi I have seen a post explaining how i can centering a region in the page. it's about page 0 definition, but i'm not finding it anymore. Someone could help me? I wanna put a main region (report and form) in the center of page. At Left side, i will ha
-
I am from the Visual Studio side of the tracks venturing into Java land. While JDev10g is impressive, the tutorials are a bit of a mess. In most cases, menu options simply dont exist or are differently named. I have also wasted loads of time running
-
I bought before some days an occasion iphone 5, but always when I like to create an icloud account, in final of the process, it appears a message like that "This device (iphone) is not allowed to create a free icloud". what I must do?