Empty strings when passing a Java object to a Stored Procedure

Hi,
I'm using the interface SQLData to pass Java objects to StoredProcedures. All the object's attributes 'arrive' to the Stored Procedure ok, except the strings, which are empty.
Here is my Oracle object:
TYPE OBJ_ASJFF_OBJ1 IS OBJECT (
ARG1 CHAR(3),
ARG2 NUMBER(4),
ARG3 CHAR(4),
ARG4 NUMBER(7),
ARG5 NUMBER(13,2),
ARG6 CHAR(1));
The nested table of that object:
TYPE TAB_ASJFF_OBJ1 AS TABLE OF OBJ_ASJFF_OBJ1;
The procedure declaration:
PROCEDURE Pup_Instaura_Processo (                              x_crCert IN TAB_ASJFF_OBJ1,
x_cResult OUT CHAR(4)
My SQLData implementation:
public void writeSQL(SQLOutput stream) throws SQLException {
               stream.writeString(getArg1());     
               stream.writeInt(getArg2().intValue());
               stream.writeString(getArg3());          
               stream.writeLong(getArg4().longValue());     
               stream.writeBigDecimal(getArg5());
               stream.writeString(getArg6());
Can anybody help me?
Thanks in advance
Rui Gonçalves

not exactly what you wanted but ingredients can be found at
- JPublisher's docuemntation (especially "Type Mapping Support Through PL/SQL Conversion Functions")
- http://otn.oracle.com/sample_code/tech/java/jsp/Oracle9iJSPSamples.html (Best Hotels PL/SQL Sample )
- http://otn.oracle.com/tech/xml/xdk_sample/xdksample_093001i.html
hope this helps
Kuassi
I have a Java Stored procedure which takes an instance of a different java object as its parameter.
I need to do this from a pl/sql package - can anyone point me to a sample etc (looked on the website but don't see one) ?
Andrew

Similar Messages

  • How to pass the java object into the spring controller

    Hi Friends
    When I hit the url at the first time my call goes to the spring controller and sets the userDetails objects in the modelAndView.addObject("userDetails", userDetails.getUserDetails()) and returns the userDetails.html page. if I click any link in the same page i want to pass same (userDetails) object thru javascript or jquery and calls the another(controller) method and returns the same (userDetails.html) page.
    It means how can i pass the java object thru javascript or jquery and calls the controller. if i get the same object in my controller i can avoid calling the db again. please help me out to resolve this issue. i am tired of fixing this issue.
    Regards
    Sherin Pooja

    If you want to avoid calling the database again then cache the data.
    However before you do that make sure that calling the database, in the context of YOUR system, is going to be an actual problem.
    For example there is absolutely no point in caching a  User object when only one user an hour is actually using the system.

  • XSLT - How to pass a Java object to the xslt file ?

    Hi ,
    I need help in , How to pass a java object to xslt file.
    I am using javax.xml.transform.Tranformer class to for the xsl tranformation. I need to pass a java object eg
    Class Employee {
    private String name;
    private int empId;
    public String getName() {
    return this.name;
    public String getEmpId() {
    return this.empId;
    public String setName(String name) {
    this.name = name;
    public String setEmpId(int empId){
    this.empId = empId;
    How can i access this complete object in the xsl file ? is there any way i can pass custom objects to xsl using Transformer class ?

    This is elementary. Did you ask google ? http://www.google.com/search?q=calling+java+from+xsl
    ram.

  • The Proper way to go - Passing Serialized Java Objects vs. Web Services?

    The team which I am apart of in our little "community" is trying to convince some "others" (management) that we should not use web services to communicate (move large data) within the same application (allbeit a huge application spanning across many servers).
    Furthermore these "others" are trying to tell us that in this same application when two small apps. inside of this large app. are both java we should not communicate via serialized java objects but instead we should use Web Services and XML. We are trying to convince them that the simplest way is best.
    They have asked us to provide them with proof that passing serialized java objects back and forth between two smaller java applications inside of a larger one is an Industry Standard. Can anyone help either straighten my fellow workers and I out or help us convince the "others" of the proper way to go?

    When I was a consultant we always gave the client what they wanted. Even if it was the wrong choice. Suck it up.
    I'm glad I wasn't one of those customers. Although I agree that a customer is the one who decides what to do, when I pay someone for consultancy, I expect them to consult me. If they know I'm trying to do something that I shouldn't be doing, I expect a good consultant to be able to show me that there's a better way (not just tell me I'm not doing it right, mind you).
    We pass a lot of data using XML and we don't have any transmission or processing speed issues.
    Then you either have a much better network than our customer did, or we're not talking about the same amounts of data here.
    I used the JAX-RPC RI ...
    That's cool... our customer was, unfortunately, infected with Borland products, so we had to use BES. The web services on BES were run by Axis.
    How large were these messages?
    Huge... each element had about 15 attributes, so 1,200 elements would require 19,200 XML nodes (envelope not included). By comparison, the serialized messages weren't even a quarter that size. It's not just about what you send across the network; it's also the effort of parsing XML compared to desrializing Java objects. Our web service wasn't exactly the only process running at the server.
    Anyone who understand the fundamental difference between ASCII (XML) and binary (serialized) formats realizes that no web service can possibly achieve the performance of binary Java services. Why do you think that work is being put into binary web services? I'm not saying XML is never a good thing; just that it's not The Holy Grail that a lot of people are making it look like.
    http://issues.apache.org/jira/browse/AXIS-688
    Ouch.

  • Passing Multi-Value Parameter to a Stored Procedure

    Has anyone experienced passing a Parameter (MultiValue) to a Stored Procedure? I am aware that Crystal Passes the Param as an Array. How would you go about handling this within a Stored Procedure???

    Hi Daniel
    Try as below:
    1. Create a Crystal report, and add a multi-value parameter.
    2. Since the multi-value parameter is treated as an array, create a formula that uses the JOIN function. Create a formula as below:
    //Formula: @JoinFormula
    Join ({?Multi-value parameter array},";")
    ====================
    NOTE:
    In the formula above, a semi-colon (";") is the delimiter.
    ====================
    3. Within the main report, create a subreport based on the stored procedure, and include the parameter to be populated with the multi-value list.
    4. Link the Join formula in the main report to the stored procedure parameter in the subreport.
    Doing so passes a multi-value parameter to the stored procedure.
    Hope this helps!!!!
    Regards
    Sourashree

  • Howto:pass an ado.recordset to a stored procedure

    Hi,
    I need to pass an adodb.recordset to a stored procedure in Oracle 8.0.5.
    I am programming with visualbasic 6, an exe application.
    I don4t know how to setting the parameter for the adodb.command which execute the procedure.
    Any idea??
    Thanks,
    Cesar,

    Hi,
    You can't do this using an OLEDB provider. There is no such a provider with this feature.
    Yuancai (Charlie) Ye
    See 30 real well-tested advanced OLEDB samples
    Use of free SocketPro for creating super client and server application with numerous samples
    www.udaparts.com

  • How to verify the user information pass by the form with a stored procedure?

    Hi,
    I would like to know how to verify user information pass by the form with a stored procedure.
    I want make a portal which accepts to new user registration, but I want verify the new user's informations (like the name don't contain a number etc).
    Thanks for your help
    regards
    jla

    Hi Samson,
    You can use the UI API to do this. You can catch the form_ADD event and then validate the input from the users. You can even block the event from completing (and stop the document from being added) if your code finds some incorrect data using the bubbleEvent functionality.
    I don't have one specific example to show you, but if you look at some of the SDK samples (for example C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\02.CatchingEvents) to see how to work with events, you can then create your own validation to ensure the users data is valid.
    Regards,
    Niall

  • ConcurrentModificationException when creating Toplink java object

    When I am adding a new java object based on a view, i get at the end of the wizard this exception and jdeveloper freezes.
    I'm using Jdeveloper 10.1.3 (latest version)
    java.util.ConcurrentModificationException
         at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
         at java.util.HashMap$EntryIterator.next(HashMap.java:829)
         at java.util.HashMap$EntryIterator.next(HashMap.java:827)
         at oracle.ideimpl.controls.SwitchablePanel.getTabPageForComponent(SwitchablePanel.java:556)
         at oracle.ideimpl.controls.FlatTabbedWindow.getTabPageForComponent(FlatTabbedWindow.java:304)
         at oracle.ideimpl.log.TabbedPage.getTabPageForLogPage(TabbedPage.java:238)
         at oracle.ideimpl.log.TabbedLogManager.getMsgPage(TabbedLogManager.java:100)
         at oracle.toplink.addin.log.POJOGenerationLoggingAdapter.updateTask(POJOGenerationLoggingAdapter.java:42)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.fireTaskUpdated(MappingCreatorImpl.java:1049)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:231)
         at oracle.toplink.addin.mappingcreation.MappingCreatorImpl.generateMappedDescriptorsForTables(MappingCreatorImpl.java:201)
         at oracle.toplink.addin.wizard.jobgeneration.JobWizard$1.construct(JobWizard.java:401)
         at oracle.ide.util.SwingWorker$1.run(SwingWorker.java:119)
         at java.lang.Thread.run(Thread.java:595)
    Does anyone know what the reason might be?

    Could it be you are creating a collection that can be modified when an iterator is al ready going over this collection.
    Could you be more specific on your project, any other toplink objects that might be manipulating the same data?
    kind regards.

  • Calling a java object from a store procedure

    I have written a translation object in java that takes a $en_var in and returns its path.
    What I need to do is call that object from a PL/SQL store procedure. All the examples I have seen treat the store procedure as a wrapper around the java object.
    But in my store procedure calling the object is only one part of the procedures role:
    The store procedure code is :
    CREATE OR REPLACE PROCEDURE WRITE_TO_FILE(in_file_name IN VARCHAR, in_en_var IN VARCHAR)
    file_handle UTL_FILE.FILE_TYPE;
    file_location VARCHAR2(50)
    BEGIN
    I need to be able to call the javaobject translation here
    file_location = translation.translatePath(in_en_var)
    file_handle := UTL_FILE.FOPEN(file_location, in_file_name, 'w');
    dbms_output.put_line ('input file name opened file name' ||in_file_name ||'-->' ||in_file_location);
    UTL_FILE.put_line(file_handle,'Hello Tony);
    UTL_FILE.FCLOSE(file_handle);
    END WRITE_TO_FILE;
    I call the java class method translatePath with a string the en_var which returns the path as a string which is then passed as a parameter to UTL_FILE.FOPEN.
    Thanks for any help
    Tony

    No Longer the problem

  • How to pass the parameter values to the stored procedure from java code?

    I have a stored procedure written in sqlplus as below:
    create procedure spInsertCategory (propertyid number, category varchar2, create_user varchar2, create_date date) AS BEGIN Insert into property (propertyid, category,create_user,create_date) values (propertyid , category, create_user, create_date); END spInsertCategory;
    I am trying to insert a new row into the database using the stored procedure.
    I have called the above procedure in my java code as below:
    CallableStatement sp = null;
    sp = conn.prepareCall("{call spInsertCategory(?, ?, ?, ?)}");
    How should I pass the values [propertyid, category, create_user, create_date) from java to the stored procedure?[i.e., parameters]
    Kindly guide me as I am new to java..

    Java-Queries wrote:
    I have a stored procedure written in sqlplus as below:FYI. sqlplus is a tool from Oracle that provides a user interface to the database. Although it has its own syntax what you posted is actually PL/SQL.

  • Pass PL/SQL Record variable to Stored procedure in Java

    Can some one please give me a code snippet for passing a Record Type variable returned by Stored Procedure. Following is the scenario.
    A record type variable REC_VAR is made of three columns of a table as follows
    EmpNo Number, Empname Varchar2(50), Zip_Code Varchar2(5).
    I am populating this variable in Java code and passing it to Stored Procedure.
    Can I referance Record Type variable in a Oracle package from Java code.
    How would I define these variables as per table’s column type and pass to SP in a java program.
    Thanks,

    58838,
    The following entry -- from the Ask Tom Web site may be helpful (assuming you haven't already seen it):
    how to access variable
    If it doesn't help, you can always search the site.
    Good Luck,
    Avi.

  • How to call a java method in a Stored procedure

    Hi.,
    I was trying to call a method in a stored procedure
    This was my procedure
    CREATE OR REPLACE PROCEDURE proc_copy_file(sr_file VARCHAR2,dt_file VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'FileCopy.copyfile(String,String)'; // calling a java method
    /   this was my java method
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "FileCopy" as
    import java.io.File;
      import java.io.IOException;
      import java.io.FileReader;
      import java.io.FileWriter;
      import javax.imageio.stream.FileImageInputStream;
      import javax.imageio.stream.FileImageOutputStream;
      import java.security.AccessControlException;
      public class FileCopy {
          // Define variable(s).
              private static int c;
              private static File file1,file2;
              private static FileReader inTextFile;
              private static FileWriter outTextFile;
              private static FileImageInputStream inImageFile;
              private static FileImageOutputStream outImageFile;
              // Define copyText() method.
              public static void copyfile(String fromFile,String toFile) throws AccessControlException
                // Create files from canonical file names.
                file1 = new File(fromFile);
                file2 = new File(toFile);
                // Copy file(s).
                try
                  // Define and initialize FileReader(s).
                  inTextFile  = new FileReader(file1);
                  outTextFile = new FileWriter(file2);
                  // Read character-by-character.
                  while ((c = inTextFile.read()) != -1) {
                    outTextFile.write(c); }
                  // Close Stream(s).
                  inTextFile.close();
                  outTextFile.close(); }
                catch (IOException e) {
                  System.out.println ("-------"); }
             // return 1;
          public static void main(String[] args){
                          switch(args.length){
                                  case 0: System.out.println("File has not mentioned.");
                                                  System.exit(0);
                                  case 1: System.out.println("Destination file has not mentioned.");
                                                  System.exit(0);
                                  case 2: copyfile(args[0],args[1]);
                                                  System.exit(0);
                                  default : System.out.println("Multiple files are not allow.");
                                                    System.exit(0);
    };while i am executing this method i m getting error as
    ORA-29531: NO METHOD COPYFILE IN CLASS FILECOPY
    ORA-06512: AT "RMVER721.PROC_COPY_FILE", LINE 1could anyone help me

    Looks like it is a matter of not quite the same namespace for String object.
    I can get it to work by the java source containing:
              public static void copyfile(java.lang.String fromFile,java.lang.String toFile) throws AccessControlExceptionAnd the PL/SQL source:
    NAME 'FileCopy.copyfile(java.lang.String,java.lang.String)'; // calling a java methodSeems like when you just use "String", then the namespace resolving in the java source is not the same as the namespace resolving in the PL/SQL?
    Addendum:
    You do not need to put java.lang.String in the java source, String will do (java.lang is by default "imported"?)
    But in the PL/SQL source java.lang namespace prefix is needed - java.lang is not "imported" here.
    Edited by: Kim Berg Hansen on Nov 23, 2011 1:07 PM

  • Hashset Object Setting in Stored procedure

    I have a store Procedure:
    CREATE PROCEDURE TESTING_SET(TEST_SET SET(CHAR(100) NOT NULL))
    RETURNING CHAR(100);
    DEFINE element CHAR(100);
    FOREACH SELECT * INTO element FROM TABLE(TEST_SET)
    RETURN element WITH RESUME;
    END FOREACH;
    END PROCEDURE;
    I am trying to call a stored procedure using CallableStetement. The stored procedure accepts a SET object. So I am setting the Hasset as CallableStatement.setObject(HashSet);
    But when the CallableStatement.execte() is called I am getting the following error:
    java.sql.SQLException: Routine (testing_set) can not be resolved.
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3631)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3963)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2693)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2609)
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:1828)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2521)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2461)
    at com.informix.jdbc.IfxResultSet.b(IfxResultSet.java:393)
    at com.informix.jdbc.IfxStatement.a(IfxStatement.java:1326)
    at com.informix.jdbc.IfxPreparedStatement.d(IfxPreparedStatement.java:449)
    at com.informix.jdbc.IfxCallableStatement.execute(IfxCallableStatement.java:331)
    at com.west.wic.test.HashSetTest.main(HashSetTest.java:40)
    Caused by: java.sql.SQLException
    at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3968)
    ... 10 more
    error message:Routine (testing_set) can not be resolved.
    error code:-674
    Please help me in this regard.

    >
    I wasn't directly replying to you
    >
    Well maybe that wasn't your intention but that is what this line in the reply means:
    >
    Posted: May 3, 2013 12:19 PM in response to: rp0428
    >
    That means you are responding to 'rp0428'; that's me. So when you say this
    >
    But first make sure that the database user you're using
    >
    And because your comments are 'in response to: rp0428' the word "you're" is generally going to be interpreted to mean 'rp0428' unless you indicate otherwise.
    If you had responded to OP that word "you're" would mean you are telling OP to
    >
    first make sure that the database user you're using
    >
    It isn't a question of 'right'; it is a question of how to address your remarks to the proper person so that that person KNOWS the remarks are meant for them.
    Here's an easy way for you to remember who to reply to: it is the same person you would LOOK at if you were in the same room with them.
    You would be looking at me while you were listening to my comments. Then you would turn and look at OP when you made yours. In the forum you accomplish that by using the 'reply' link on one of OP's comments.
    If, for some reason, you did want to make comments to both of us in your one reply then pick one to reply to, even me, and then preface your comment to OP like this:
    >
    -- comment here for rp0428 - but you didn't make any
    OP: first make sure that the database user you're using . . .
    >
    See how that 'OP:' prefix makes it clear that, even though your comments are 'in response to: rp0428' that particular comment is meant for OP?
    It might be aarkward at first but once you try it a few times you'll get the hang of it. ;)

  • Java and Sybase nested stored procedures.

    Hi!
    I have nested Sybase stored procedures, the main procedure calls a helper stored proc.
    The main procedure returns 2 result sets before calling the helper store proc and helper store proc returns 1 resultset. After the helper store proc is called, the main store proc returns 2 more resultset. When I run it using SQL client tool the main procedure(and it's helper) execute well and returns rows.
    I need to call this store proc in a java code and display all the resultset in screen. I am using Statement:execute(<exec sp>) to execute the store proc and then statement.getResultSet() to get each resultset. The loop is controlled by statement.getMoreResults() .
    It displays the first 2 resultsets from main Store Proc. Then the control goes to helper store proc. It executes the helper store proc and displays the resultset from helper. But then it stops there and doesnot
    come back to main store proc to execute the remaining resultset.
    What I suspect is that, the statement object is getting overlaid when the call goes to helper proc.
    Any idea as to how to code to handle multiple nested resultset ?
    ~ RNS.
    My Sybase stored procedure code looks like -
    =======================================================================
    create procedure main_proc
    @param1 int
    as
    select getdate()
    select @@servername
    declare @return_val int
    exec proc2 @param1, @return_val out
    select myCol1,
    myCol2,
    myCol3=@return_val
    from mytable
    select db_name()
    ===========================================================================
    Sybase Code for proc2
    create procedure proc2
    @param1 int,
    @param2 int out
    as
    begin
    if something exists(select * from table where whereClause)
    select @param2="TRUE"
    else
    select @param2="FALSE"
    select getdate()
    end
    go
    GRANT EXECUTE...
    EXEC sp_procxmode 'dbo.proc2,'unchained'
    go
    ====================================================================
    Code snippet :-
    do {
    int iit=0;
    rs=stmt.getResultSet();
    if ( rs != null ) {
    ResultSetMetaData rsd = rs.getMetaData();
    int nocols = rsd.getColumnCount();
    for (int i=1; i<=nocols; i++)
    System.out.println(rsd.getColumnName(i)));
    while (rs.next())
    for (int i=1; i<=nocols; i++)
    System.out.println(rs.getString(rsd.getColumnName(i));
    } while (stmt.getMoreResults());

    I'm not 100% sure about this, but my guess is that this is caused by the TDS protocol (used by Sybase). TDS makes no difference between the stored procedure you are calling and the "inner" stored procedure, so the driver just returns update counts and result sets as they are generated, regardless of who generated them.
    Another guess (as I don't know what driver you are using) is that execute() returns the first result (update count or ResultSet), as opposed to executeQuery(), which returns the first ResultSet (probably discarding the update count). You can make sure of this by calling getMoreResults(); you should get your ResultSet at some point.
    Alin.

  • URGENT: Passing Array from JSP to a Stored Procedure

    Hi,
    Can some one please help me understanding how can I pass array from JSP page to a stored procedure in database.
    Thanks in advance.
    Jatinder

    Thanks.
    I tried ArrayExampla.java and was successful in passing array values to the stored database procedure.
    How can I use this class in JSP? Like I have first JSP where in I will collect input from the user and then submit it to the second JSP - that needs to call the ArrayExample.java to pass the values as array to the database.
    How should I call this java code in my second JSP?
    Thanks in advance.

Maybe you are looking for