Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC passing xml created using DocumentBuilderFactory as input to oracle stored procedure using java JDBC

Have Programming Question? Ask it here!
 
 
 


prem anand
passing xml created using DocumentBuilderFactory as input to oracle stored procedure using java JDBC
0 Answer(s)      2 years and 10 months ago
Posted in : JDBC


I want to send the xml as input parameter to the stored procedure.XML will be created using DocumentBuilderFactory and it is to be send using JDBC. Stored procedure in oracle database will contains two input parametes and an output parameter.first input parameter is an integer and second one receives xml as input and parse it according to the columns in table and performs further operations.third one is the out parameter that gives the result either success/failure. All the work related with procedures,creating xml are completed and working fine,but i can't able to send the xml created using the documentbuilder to the stored procedure.I tried by using XMLType/Clob format..no use..Everytime i am getting the same error.Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'PRCNUMBERRANGE_INSERTION' ORA-06550: line 1, column 7:

here is my java code... import java.io.; import javax.xml.parsers.; import javax.xml.transform.; import javax.xml.transform.dom.; import javax.xml.transform.stream.*;

import oracle.jdbc.OraclePreparedStatement; import oracle.jdbc.OracleCallableStatement; import oracle.jdbc.OracleResultSet; import oracle.jdbc.OracleTypes; import oracle.xdb.XMLType;

import oracle.xdb.dom.XDBDocument; import oracle.xdb.dom.XDBDomImplementation;

import org.w3c.dom.*;

import java.sql.CallableStatement; import java.sql.Clob; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLXML; import java.sql.Statement; import java.sql.Types;

import java.util.ArrayList; public class xml3 { public static void main(String[] args) throws Exception {

DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.newDocument(); Element rootElement = document.createElement("Request"); document.appendChild(rootElement); Element em = document.createElement("NumbersToPort"); Element em1= document.createElement("TelephoneNumberFrom"); Element em2= document.createElement("TelephoneNumberTo"); em1.appendChild(document.createTextNode("9980000000")); em2.appendChild(document.createTextNode("9980000000")); em.appendChild(em1); em.appendChild(em2); rootElement.appendChild(em);

TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(System.out); transformer.transform(source, result);

Connection con=null; Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("driver specific........."); con = DriverManager.getConnection("jdbc:oracle:thin:@10.100.23.155:1521:WNPG", "WEBSERVICE", "WEBSERVICE"); System.out.println("successfully connected........."); OracleCallableStatement stmt=(OracleCallableStatement) con.prepareCall("{ call PKGNUMBERRANGE.prcnumberrange_insertion(?,?,?)}"); System.out.println("calling the procedure.."); XMLType poXML = XMLType.createXML(con, document); stmt.setString(1,"120"); System.out.println("id passed as param.."); stmt.setObject(2,poXML); System.out.println("xml passed as param..");

stmt.registerOutParameter(3,OracleTypes.CURSOR); System.out.println("recv the output as param.."); ResultSet rset=stmt.executeQuery(); System.out.println("call executed.."); OracleResultSet rs_single = (OracleResultSet) rset;

while(rs_single.next()) { System.out.println("return value.."+rs_single.getString(1)); }

con.commit(); con.close(); } }

Please give any solution..


Advertisement
View Answers

Related Tutorials/Questions & Answers:
passing xml created using DocumentBuilderFactory as input to oracle stored procedure using java JDBC
passing xml created using DocumentBuilderFactory as input to oracle stored procedure using java JDBC  I want to send the xml as input parameter... and it is to be send using JDBC. Stored procedure in oracle database will contains two
servelet connectivity with oracle using procedure
servelet connectivity with oracle using procedure   kindly elaborate how servlet code connect to oracle br using procedure
Advertisements
callable statement,stored procedure for insert data and also for update data into oracle database using jsp
callable statement,stored procedure for insert data and also for update data into oracle database using jsp  iam a fresher newbie to softparsing i... procedure for inserting data into oracle database as bind variable and same
creating and executing stored procedure using hibernate
creating and executing stored procedure using hibernate  I have to execute following query using hibernate DECLARE @i_STARTDATETIME DATETIME DECLARE @i_ENDDATETIME DATETIME DECLARE @o_ERRORCODE INT DECLARE @o_ERRORDESCRIPTION
Insert Data in Table Using Stored Procedure
into a table using stored procedure. Steps: 1.Create database: To create...;); 7.Step to call procedure: We are using CallableStatement to execute a stored... Insert Data in Table Using Stored Procedure   
Stored Data in XML File using Servlet
Stored Data in XML File using Servlet  ... to stored data in xml file using Servlet  We have created  file login.jsp... a message 'Xml File Created Successfully'.   JAXP (Java API for XML
Difference between getting a document using DOMParser & DocumentBuilderFactory !!!
Difference between getting a document using DOMParser & DocumentBuilderFactory !!!  Hi, In DOM tutorials, on one page a document is formed using DocumentBuilderFactory and on the other page, document is formed using DOMParser
Error in MySQL Procedure Using JAVA Code
Error in MySQL Procedure Using JAVA Code  The following Java code (using Connector/J to create a stored procedure on MySQL 5.0) does not execute...("DELIMITER //\nCREATE PROCEDURE abdt (std INT)\nBEGIN\nSELECT attbegin, attend FROM
stored procedure
stored procedure  what is stored procedure
What is Stored Procedure?
the network by several clients using different input data. And when the procedure...What is Stored Procedure?  What is Stored Procedure?   Hi, Here is the answer, A stored procedure is a named group of SQL statements
remote procedure call using java - JSP-Servlet
remote procedure call using java  what is the romote procedure call and related coding in java?  Hi Friend, The RPC (Remote Procedure Call) is a mechanism that enables a remote procedure call from a client
stored procedure
stored procedure  on storing values to database using stored procedure it throws an error lyk ADODB.Command error '800a0bb9' Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another
JPA 2.1 Stored Procedure Example
for programmers. You can easily call stored procedure from your Java.... These are database specific and created using the SQL statements. In oracle this language is called PL/SQL. Oracle database server also supports stored procedure
JDBC CallableStatement Example
statement provides a way to call the stored stored procedure of the database... is give below which calls the stored procedure HI() from database student. At first create a database student in MySql Then Create a Stored procedure
accessing xml using java
accessing xml using java  I need to retrieve some elements in xml file using java   Hi Friend, Please visit the following links: http://www.roseindia.net/xml/Listingnode.shtml http://www.roseindia.net/xml/getting
XML parsing using Java - XML
XML parsing using Java  I'm trying to parse a big XML file in JAVA. The goal is like i will take console input from user until "Coverage" in element "MIRate"(THE XML code is below).once he enters coverage rate I need
Read XML using Java
of all i need to read xml using java . i did good research in google and came to know.../xmlParsing/java-xml-parsing-using-sax.shtml http://www.roseindia.net/xml/sax...Read XML using Java  Hi All, Good Morning, I have been working
Insert or retrieve image into oracle 10g by using java
Insert or retrieve image into oracle 10g by using java   How can i insert or retrieve image into oracle10g using java plz i need it urgently,need guidance to do this plz
xml file reading using java
xml file reading using java  hi deepak I want to read some data from xml file and send that output to particular email address using java  ...)throws Exception{ DocumentBuilderFactory docFactory
Exception while inserting image in oracle using java
Exception while inserting image in oracle using java  import...()); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost... affected: "+stmt.executeUpdate()); } } My Oracle table description is: create table
read xml using java
read xml using java  <p>to read multiple attributes and elements from xml in an order.... ex :component name="csl"\layerinterfacefile="poo.c... is only allowed to take place using this layer. The data stored is composed
update date from stored procedure
update date from stored procedure  how to works on insert,update data from stored procedure.   Insert data using stored procedure
store the image in the oracle using blob and get it back - JDBC
store the image in the oracle using blob and get it back  hi i am...("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin...(); } } --------------------------------------- In this program using jdbc driver
What are the advantages of using Stored Procedures?
What are the advantages of using Stored Procedures?  What are the advantages of using Stored Procedures
store the image in the oracle using blob and get it back - JDBC
store the image in the oracle using blob and get it back  hi i am facing problem in the following code . this code can store the image in table...("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin
Passing a parameter using URL string
Passing a parameter using URL string  How to pass a parameter using the URL string in a JSF application
Passing parameters in JSP using forward.
Passing parameters in JSP using forward.  If a page is forwarded to another page using jsp:forward, is it necessary that the page should be already created? Or will the compiler create one?   Hi, it necessary
Stored Procedure and Trigger
Stored Procedure and Trigger  hello, What is the difference between Stored Procedure and Trigger ?   hii, Triggers once defined are called automatically, there can be no explicit invocation Stored procedure has
XML clonning with java and passing arguments
XML clonning with java and passing arguments  Hi, I have a XML file as follows. My requirements are as below. 1. Clone the whole xml file. 2... if 2 then with arguments1 and then arguments2. <?xml version=ΓΆβ?¬Β?1.0??>
Validation on input xml in java program - XML
Validation on input xml in java program  Hi.. i am accepting xml data as input which I have to use in my program. i have to validate this input xml against some schema using xml beans and NOT by using sax or dom parser. I am
xml Converting to java using JDOM
xml Converting to java using JDOM  Hello , I am new to java and JDom so i make a Xml file and i need help to read it from java using objects , my... should be inside a student object i will include the java code and xml code and i
how to create xml schema from xml doc using java
how to create xml schema from xml doc using java  i want to create xml schema from xml document programatically using java... am using Netbeans IDE 7.0 i hav created the xml document for a table of data from Database... now i
oracle database backup using jsp
oracle database backup using jsp   I want to take the backup of oracle database.I want to write the code in jsp ,so that when the page is loaded a backup of the database is stored in one of my local drives.Is it possible to do
Processing stored procedure in MySQL - SQL
Processing stored procedure in MySQL  Dear All java with mysql developer..... i need to convert my SQL procedure to MySQL database... here is my Stored procedure in SQL.... create or replace procedure INVNAMES (bno
parsing xml file using java code
parsing xml file using java code  parsing a xml file using java code
How to delete excel file records using Store Procedure?
How to delete excel file records using Store Procedure?  Hi.. I have created one Excel file through stored procedure.Now I want to delete records or delete excel file. Thanks
Interceptors Configuration using Java or XML
In this section, you will learn about how to configure interceptors using Java or XML
excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same... used JDBC ODBC to read from excel file. i am not able to append it using
java to oracle code - JDBC
java to oracle code  please suggest m calculate the database performance between scaled images and unscaled images in the database
Java vs Oracle Connectivity - JDBC
Java vs Oracle Connectivity  Write a java program to establish connection with oracle database?  Hi Friend, Use Oracle with Java... are using oracle oci driver,you have to use: Connection conn
Passing classid or name in request using Jquery
Passing classid or name in request using Jquery  Hi, I am new to JQuery.I have a servlet that I am calling using jquery.I have some parameters like filename,userid that I am passing to the servlet to upload a file.I have created
java connecting to oracle db - JDBC
java connecting to oracle db  how to connect oracle data base...) Connect to database:*********** a) If you are using oracle oci driver,you have to use: Connection conn = DriverManager.getConnection("jdbc:oracle:oci8
receive a ResultSet from a stored procedure
receive a ResultSet from a stored procedure  How do I receive a ResultSet from a stored procedure
how to read and write an xml file using java
how to read and write an xml file using java  Hi Can anyone help me how to read and write an xml file which has CData using java
image store in oracle using jswing
image store in oracle using jswing  hello ,ihave searched the image store in oracle using jswing but i did not find the code please help me
Which JDBC Type Using - Java Beginners
Which JDBC Type Using  As there are 4 types of JDBC driver. I wanted to know: How would one come to know that which jdbc type any web application is using (if Db is oracle or mysql or MSSQL)? Thanks, Sushma  Hi
Create XML File using Servlet
Create XML File using Servlet   ... XML file with its version and encoding and display a message 'Xml File Created Successfully'.   JAXP (Java API for XML Processing) is a Java
Sending and receiving xml message using Java Program
Sending and receiving xml message using Java Program  Hi Friends, I want to send and receive xml files between two java programs using wire format, could you suggest me the steps to be followed to acheive it or suggest some
Sending and receiving xml message using Java Program
Sending and receiving xml message using Java Program  Hi Friends, I want to send and receive xml files between two java programs using wire format, could you suggest me the steps to be followed to acheive it or suggest some
How to Split a large XML file using java?
How to Split a large XML file using java?  How can we split a 500MB Xml file?I know how to split xml file after reading the entire document in a file.Here we cannot load the entire file as it is a large file
 

 

 

DMCA.com