How to reference MS Database from XML datasource?
Hi,
I have been tasked with writing an XML BI Publisher report that involves pulling data stored on our SQLServer database. I wasn't sure how to do this so I searched through my documentation and found information on Distributed Queries which I think addresses what I am trying to do. So I created a simple datasource test script based on the documentation to see if I could access the SQLServer database but I am having problems getting this to work. I created a datasource script, setup a concurrent job and tried to run the report but I'm getting a "java.sql.SQLException: ORA-00933: SQL command not properly ended" error.
Can somebody please help me in regard to my problem and tell me what I'm doing wrong? I am using the XML Word plugin 10.1.3.4.1. Here's the datasource code.
<?xml version="1.0"?>
<dataTemplate name="XXKNC_TIMECENTRE_TEST" description="XXKNC - TimeCentre XML" dataSourceRef="TimeCentre" version="1.0">
<dataQuery>
<sqlStatement name="Q1_TimeCentre">
<![CDATA[
SELECT DISTINCT CardID, EmployeeName
FROM tc2kdb.dbo.EmployeeT
where CardID < 500
order by EmployeeName
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_TimeCentre" source="Q1_TimeCentre">
<element name="CardID" value="CardID" />
<element name="EmployeeName" value="EmployeeName" />
</group>
</dataStructure>
</dataTemplate>
Thank you,
Steve
Bipuser,
That still didn't work. I was thinking about this and my problem. When I am trying to access a database on the sqlserver I have to tell Oracle this by adding dataSourceRef="TimeCentre" to my datasource correct? But my TimeCentre reference is set up as an ODBC connection and I think this is the problem. Where or how do I setup this connection if we are not using BI Publisher server and only using the MS Word Pulgin? Or does Oracle somehow know that dataSourceRef="TimeCentre" is referencing a SqlServer database over an ODBC connection? I'm not sure if I should be setting up the TimeCentre link differently.
Thanks again for taking time to help me with this problem,
Steve
Similar Messages
-
How to insert the data from XML to a table
Hi,
I'm using Oracle 10g Express Edition
I need help in How to insert the data from XML file into the table.
Below is the example i'm working on..
I have create ridb user with below mentioned privileges:
Account Status Locked Unlocked
Default Tablespace: USERS
Temporary Tablespace: TEMP
User Privileges :
Roles:
CONNECT
RESOURCE
Direct Grant System Privileges:
CREATE DATABASE LINK
CREATE MATERIALIZED VIEW
CREATE PROCEDURE
CREATE PUBLIC SYNONYM
CREATE ROLE
CREATE SEQUENCE
CREATE SYNONYM
CREATE TABLE
CREATE TRIGGER
CREATE TYPE
CREATE VIEW
& table is created TRIALZIPCODES below mentioned is the DDL:
CREATE TABLE TRIALZIPCODES
STATE_ABBR VARCHAR2(20) NOT NULL
, ZIP_CODE NUMBER(10, 0) NOT NULL
, ZIP_CODE_EXT VARCHAR2(20)
Below is the XML FILE: which is stored in C:\OracleProject Folder
File name: trial.xml
<?xml version="1.0" ?>
<metadata>
- <Zipcodes>
- <mappings Record="4">
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>94301</ZIPCODE>
</mappings>
- <mappings Record="5">
<STATE_ABBREVIATION>CO</STATE_ABBREVIATION>
<ZIPCODE>80323</ZIPCODE>
<ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
</mappings>
</Zipcodes>
</metadata>
PL/SQL Procedure:which i'm trying to execute from SQLDeveloper
create or replace
PROCEDURE TRIAL AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
begin
-- DBMS_XMLGEN.setRowTag ( ctx IN ctxHandle, rowTag IN VARCHAR2);
-- DBMS_XMLGEN.setRowSetTag ( ctx IN ctxHandle, rowSetTag IN VARCHAR2);
-- the name of the table as specified in our DTD
DBMS_XMLGEN.SETROWSETTAG(l_context_handle,'zipcodes');
-- the name of the data set as specified in our DTD
DBMS_xmlgen.setRowTag(l_context_handle,'mappings');
-- for getting the output on the screen
dbms_output.enable(1000000);
-- open the XML document in read only mode
v_FileHandle := utl_file.fopen('c:/OracleProject','trial.xml', 'r');
loop
BEGIN
utl_file.get_line(v_FileHandle, charString);
exception
when no_data_found then
utl_file.fclose(v_FileHandle);
exit;
END;
dbms_output.put_line(charString);
if finalStr is not null then
finalStr := finalStr || charString;
else
finalStr := charString;
end if;
end loop;
-- for inserting the XML data into the table
insCtx := DBMS_XMLSTORE.NEWCONTEXT('RIDB.TRIALZIPCODES');
insCtx := DBMS_XMLSTORE.INSERTXML(insCtx, finalStr);
dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
DBMS_XMLStore.closeContext(insCtx);
END;
END TRIAL;
For the first time when i complied i got the errors as :
Procedure RIDB.PROCEDURE1@RIDB
Error(16,14): PLS-00201: identifier 'UTL_FILE' must be declared
Error(16,14): PL/SQL: Item ignored
Error(29,1): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(29,1): PL/SQL: Statement ignored
Error(33,1): PL/SQL: Statement ignored
Error(33,19): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(36,1): PL/SQL: Statement ignored
Error(36,17): PLS-00320: the declaration of the type of this expression is incomplete or malformed
So i logged in as sys & grant the permission to execute on UTL_FILE to ridb (user):
SQL Statement:
grant execute on utl_file to ridb
So, it got compiled successfully but when i execute it gives me error as:
Source does not have a runnable target.
What does this mean?
So I browse through forum & i got to know that i need to initial the UTL_FILE_DIR ="C:/OracleProject" in init.ora
So can i edit the init.ora with notepad.When i tried to do that it says permission denied
In my system it shows the init.ora file in path C:\oraclexe\app\oracle\product\10.2.0\server\config\scripts
but there is also other file initXETemp in the same path do i need to do the changes in it.
I have tried even editing the SPFILE as mentioned below:
C:\oraclexe\app\oracle\product\10.2.0\server\dbs\SPFILEEXE - I had edit this file using notepad & set the value of UTL_FILE_DIR ="C:/OracleProject". So next time when i restarted i'm unable to log on to the database.
So i had reinstall the software again.
Could you please let me know how to proceed..hi,
I have created the directory from sys database
CREATE or replace DIRECTORY XML_DIR2 AS 'C:\OracleProject';
& grant read,write access to the user
grant read,write on directory XML_DIR2 to RIDB;
& i had change the tag name in the xml file as shown below:
<?xml version = '1.0'?>
<metadata>
<Zipcodes>
<mappings Record="4">
<STABBRE>CA</STABBRE>
<ZIPCODE>94301</ZIPCODE>
</mappings>
<mappings Record="5">
<STABBRE>CO</STABBRE>
<ZIPCODE>80323</ZIPCODE>
<ZIPCODEEXT>9277</ZIPCODEEXT>
</mappings>
</Zipcodes>
</metadata>
TRIALZIPCODE table as shown below:
CREATE TABLE "RIDB"."TRIALZIPCODE"
( "STABBRE" VARCHAR2(20 BYTE),
"ZIPCODE" NUMBER(*,6) NOT NULL ENABLE,
"ZIPCODEEXT" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
I have tried two methods as shown below:
Procedure 1:
create or replace
PROCEDURE TRIAL_V2 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
insCtx := DBMS_XMLStore.newContext('DEV.TRIALZIPCODES');
DBMS_XMLStore.setUpdateColumn(insCtx, 'STABBRE');
DBMS_XMLStore.setUpdateColumn(insCtx, 'ZIPCODE');
DBMS_XMLStore.setUpdatecolumn(insCtx, 'ZIPCODEEXT');
DBMS_XMLStore.setRowTag(insCtx, 'mappings');
cnt := DBMS_XMLStore.insertXML(insCtx, xmldoc);
DBMS_XMLStore.closeContext(insCtx);
END;
Procedure 1 was compiled with out errors but when i execute i got the error as :
Source does not have a runnable target.
Procedure 2_
CREATE OR REPLACE PROCEDURE TRIAL_V3 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
INSERT INTO trialzipcode (STABBRE, ZIPCODE, ZIPCODEEXT)
SELECT extractvalue(x.column_value, 'mappings/STABBRE'),
extractvalue(x.column_value, 'mappings/ZIPCODE'),
extractvalue(x.column_value, 'mappings/ZIPCODEEXT')
FROM TABLE(
XMLSequence(
EXTRACT(
xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') ),
'metadata/Zipcodes/mappings'
) x
END;
END TRIAL_V3;
Procedure 2 was complied without errors but when i execute i got the error as:
Connecting to the database RIDB.
ORA-22288: file or LOB operation FILEOPEN failed
The system cannot find the file specified.
ORA-06512: at "SYS.DBMS_LOB", line 523
ORA-06512: at "SYS.XMLTYPE", line 287
ORA-06512: at "RIDB.TRIAL_V3", line 12
ORA-06512: at line 2
Process exited.
Disconnecting from the database RIDB.
Could you please let me know how to proceed... -
Hi, How to move SQL database from one location to another location i.e. from C' drive to D' drive ? please share some link.
Thanks and Regards, Rangnath MaliHi Rangnath,
According to your description, my understanding is that you want to move databased from C drive to D drive.
You can detach Database so that the files become independent, cut and paste the files from source to destination and attach again.
There are two similar posts for your reference:
http://mssqltalks.wordpress.com/2013/02/28/how-to-move-database-files-from-one-drive-to-another-or-from-one-location-to-another-in-sql-server/
http://stackoverflow.com/questions/6584938/move-sql-server-2008-database-files-to-a-new-folder-location
Best Regards,
Wendy
Wendy Li
TechNet Community Support -
How to connect mysql database using xml
welcome to all,
here my doubt is how to connect mysql database using xml file, how to integrate xml file and jsp file and how to access data from dabase using jsp file. can any one help me
regardsShort answer: you wouldn't do any of those things. The first two are meaningless and the third is a bad practice. I have no idea what those ideas were supposed to achieve so I have no idea what tutorials I should suggest to you.
-
How to get string value from xml in JSF??
In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF
Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization. -
How to create Inbound Idoc from XML file-Need help urgently
Hi,
can any one tell how to create inbound Idoc from XML file.
we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml' we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
Please let me know the process to trigger inbound Idoc with out using XI and any other components.
Thanks in advance
Dora ReddyHi .. Did either of you get a result on this?
My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
I see lots of mention of using a Function Module.
Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
Or is there something tht can be done with Standard SAP?
Thanks
Lee -
How to connect oracle database from tuxedo
Hi,
How to connect oracle database from tuxedo.
If any one can help me.
Regards,it depends on configuration your going to choose, there are two ways--
- Using X/Open standards, for this
you have to make an entry of Resource manager in $TUXDIR/udataobj/RM file.
Then in UBBConfig file in GROUPS section u have to set Openinfo.
It also depend on which database you are going to use.
In your service now you need to call tpopen() API from tpsvrinit() function.
- Other possibility is, take an implicit connection using Pro*C or Pro*Cobol whatever platform you are using.
EXEC SQL Connect ... -
How to connect informix database from informatica through JDBC instead of ODBC
How to connect informix database from informatica through JDBC instead of ODBC.
Hi mate,
You may get fast reply for this in informatica forums.
Thanks
http://mkashu.blogspot.com -
How the data extraction happens from HR datasources from R/3 to BW system.
Hello All
How the data extraction happens from HR datasources from R/3 to BW system.Incase of delta records ( for CATS datasources ) ,Is there any flow like LO .
Incase of Full and delta loads how does the data will be taken from R/3 to BW,DO we need to fill setup tables ?
Searched forum but couldnt able to find the relevant one.
Thankyou
ShankarHi Shankar.
HR Datasources do not have setup tables . Though before implementation, certain customizations should be done and the delta loads have dependency on other data sources. Also you must have implemented Support Package SAPKH46C32, or have made the relevant corrections in SAP Note 509592.
Follow this link for details on customization and dependencies for all CATS datasources.
http://help.sap.com/saphelp_nw70/helpdata/en/86/1f5f3c0fdea575e10000000a114084/frameset.htm
Regards,
Swati -
How to startup the database from pfile?
Hi guys.
hope all of you fine.
how to startup the database from pfile?
Thanks.You can create pfile from spfile
SQL>create pfile='/tmp/pfile.ora' from spfile;
then
SQL>startup pfile='/tmp/pfile.ora';
You can edit pfile.ora file and startup your database with this newly changed database parameter using pfile
And you can define you're using pfile or spfile by issuing:
SQL> show parameter spfile; -
How to upload the data from XML file to SAP database using IDOC
Hi,
I need some steps to upload data from XML format file from other directory to SAP database using IDOC.
how to approch this please if any one knows give me ans
it will be a great help ful to me
Thanks in Advance
MallikThank you vijay,
But i heard that by using this Fun modules, when we are passing IDOC in back ground schedule, so some other depended FM not supporting, so how to approach this and how to avoid this problem.
Have you worked on this before if any one worked on this please help me out
And thank you once again for your valuable information
Best Regards
Mallik -
How to read the data from XML file and insert into oracle DB
Hi All,
I have below require ment.
I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
Many Thanks.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. -
How to remove an Element from XML by confirming Attribute of that element
Hi guys
I have an XML file where i have all users DB. Now i want to remove a user from that XML file. I want to check an user id attribute which is uniqe with existing users in XML file, if its the same user then delete this user from XML file and save the changes in XML file.
here is my XML file:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user id="zahid" password="X8UrUN79avT27LYwUESiliAV328=" name="Zahid Nawaz" phone="9599808" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
<user id="Admin" name="alpha beta" password="fEqNCco3Yq9h5ZUglD3CZJT4lBs=" phone="456782656" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
<user id="Guest" name="beta alpha" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="8765432" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" /><user id="Guest1" name="unknown unknown" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="123122112" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" />
</users>for example i want to delete a user which have user id= Guest.
How can i do it in Java. Any code example please. i am using JDOM document and SAXBuilder for parsing.
Waiting for your replay.
Thanks in Advance
Best regardHi,
Till now i tried the following code which give null pointer exception at following line
element.getParentNode().removeChild(element);
public String removeUserByID(String id) throws Exception{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer tFormer = tFactory.newTransformer();
doc = builder.parse(usersXml);
Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);
// Remove the node
element.getParentNode().removeChild(element);
// Normalize the DOM tree to combine all adjacent nodes
doc.normalize();
FileOutputStream fos = new FileOutputStream(this.usersXml);
XMLOutputter out = new XMLOutputter();
out.output(((org.jdom.Document)doc), fos);
/* Source source = new DOMSource(doc);
Result dest = new StreamResult(System.out);
tFormer.transform(source, dest);
System.out.println();
return "true";
if following line i m trying to use first attribute of my XML file where i am passing a string which is for example like "user id=Guest". id is a string which have user Id "Guest".
Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);So any suggestion??Whats wrong here?
Best regards and thanks again 4 ur reply. -
Hi,
I'm using javaDb embedded and I trying to find the best way to create a database from a xml file.
I managed to do this, previously with netbeans 6.9, jdk 6 and apache ddlutils.
Unfortunately this method as proven to be not so good, and and can't get it to work with netbeans 7.
Is there a best way to do this?? Any recommendation on this matter will be appreciated.
Thanks in advance,
Hugos3c wrote:
Hi,
I'm using javaDb embedded and I trying to find the best way to create a database from a xml file.
I managed to do this, previously with netbeans 6.9, jdk 6 and apache ddlutils.
Unfortunately this method as proven to be not so good, and and can't get it to work with netbeans 7.
Is there a best way to do this?? Any recommendation on this matter will be appreciated.
Thanks in advance,
Hugowhat does question or solution have to do with forum TOPIC Oracle RDBMS? -
How to create a database from dfj zip file
Hi,
I have created a database template via DCA from PC-1 which has got oracle 9i and it has produced a file with extention dfj.
I am trying to create a new database using this dfj file on a different pc which has oracle 10g.
1- How can i use dfj file to create a new database?
2- Can i use Oracle 9i templates in Oracle 10g?-in dbca you have the option to create the database from existing template
-not sure if we can simply use 9i template in 10g but you may try, chances are less.
Maybe you are looking for
-
Is there a way to...
Now.. that's a nice probleme i've got... Is there a simpler way to make this tween of a text ( static text converted to graphic ) without having to "cheat" ? ( all tween are done using the classic tween) - What i want : - keyframe #1 : text helvetica
-
Installing elements 4.0 on my (disc drive-less) new mac??
I recently treated myself to a new macbook air, which doesn't have a disc drive, and want to install a photoshop elements 5.0/4.0 macintosh disc. I'm hoping that I will be able to download directly from adobe (although I realise it's an ancient prog
-
Need Code for XML content into Xlet
"How to read XML file and How to display on Xlet interface." If you know it. please post me thank you lak
-
Hi , I have installed Jdev using silent installation . Now I have some apps already created I want to create a default domain and then deploy apps into that through ant or any script? Can anyone help me on this? Thanks and Regards, Vivek Pemawat
-
Where is mail stored under Tiger?
I want to back up old correspondence, both outgoing and incoming. Where are they stored? Thanks.