Pass user-defined Interfaces between JSPs

          Hi, I am using weblogic 6.0wSP1 on win2k. I'd like to pass some
          user_defined interfaces/classes variables between JSPs at run time. I've been
          tried using <jsp:include page...> However, the issue is that it was using http
          potocol to convert my Object into String when I wanted to retrieve the parameter
          using getParameterValues("name"). So does anyone know how I can handle it?
          Any help is appreciated...
          

          Hi, Xiang Rao
          Thank you very much to reply my question. It did work so far.
          Sharon
          "Xiang Rao" <[email protected]> wrote:
          >
          >If you want to pass object to different pages, you should use request.setAttribute(name,
          >obj) and retrieve the object with (Your_class_or_object_cast)request.getAttribute(name).
          >
          >
          >"Sharon Zhou" <[email protected]> wrote:
          >>
          >>Hi, I am using weblogic 6.0wSP1 on win2k. I'd like to pass some
          >>user_defined interfaces/classes variables between JSPs at run time.
          >I've
          >>been
          >>tried using <jsp:include page...> However, the issue is that it was
          >using
          >>http
          >>potocol to convert my Object into String when I wanted to retrieve the
          >>parameter
          >>using getParameterValues("name"). So does anyone know how I can handle
          >>it?
          >>Any help is appreciated...
          >>
          >>
          >
          

Similar Messages

  • Difference between interfaces in Java API and user defined interfaces

    Is there any differences between the interfaces (such as KeyListener, ActionListener and EventListener etc.,) in Java API and the user defined interfaces.
    The user defined interfaces seems to be empty without any functionality (except its constant and method declarations). But the interfaces in Java API seems to have some functionality behind them, since they route the device events to the programs.
    Actually what is happening behind the Java API's interfaces?
    Please clarify.

    Ummm, no they are not (or at least some of them are not). Also, some things we support now we may not have supported in a previous release.
    If you look at the section 2 (Working with TimesTen Data Stores0 in the TimesTen Java Developer's Guide and look at the sections:
    TimesTen JDBC Extensions
    Additional TimesTen classes and interfaces
    then you will see the extra functionality documented there. Of course, if you do not need any of this functionality then you can simply treat them as the base classes from java.sql and they will work fine so it is easy to make most of your code generic.
    Chris

  • Passing user defined parameters in oracle reports thru command line

    Hi All
    We are currently using Reports 6i with Oracle 10g 10.2.0.4.0
    I would like to know that is it possible to pass user defined parameters values while calling report from command line.
    For Example: I am using following coding to call report from command line.
    for /f "tokens=1-3 delims=/ " %%a in ('date /t mm/dd/yyyy -1') do (
    set mm=%%b
    set dd=%%a
    set yyyy=%%c)
    rwrun60 report=c:\reports\banks.rdf userid=express/test@test_rs2 destype=FILE desname=c:\reports\banks%dd%%mm%%yyyy%.pdf desformat=PDF BACKGROUND=NO BATCH=YES
    The report contains some user defined parameter which is using in where condition of reqport query.
    Select * from banks
    where id = :Bank_ID
    Now I want to Pass value for :Bank_Id from command line (like we pass parameter list while calling report with run_product), how it is possible?
    Thanks
    Hassan

    Hi guys
    Fortunately I am able to perform the required task as I just added the report parameter field as follows:
    rwrun60 report=c:\reports\banks.rdf userid=express/test@test_rs2 destype=FILE desname=c:\reports\banks%dd%%mm%%yyyy%%h%%mi%%ss%%ts%.pdf desformat=PDF BACKGROUND=NO BATCH=YES ERRFILE=c:\reports\error.log LOGFILE=c:\reports\joblog.log bank_id='MCB'
    bank_id is the report parameter using in where clause.
    Regards,
    Hassan

  • Passing user-defined field to Backend system

    Hi All,
    Please advice how we can pass user-defined fields of shopping cart to same user-defined fields in purchase requisition/purchase order in backend R/3 system.
    I know there is parameter IT_CUF_ITEM in BADI BBP_CREATE_REQ_BACK. If anyone know how to pass field values by this parameter or otherwise, it will be very helpful to me.
    Thanks & Regards,
    Kamaljit Singh

    Hello Kamaljit,
    If you want to pass the custom parameters then you can use the badi BBP_CREATE_PO_BACK/BBP_CREATE_REQ_BACK to fill the header/Item level parameters.
    while building the item level parameters internal table, make sure that you are passing the header guid and the item number and the R/3 BackEnd table name,Fieldname(R/3 Custom Fieldname) with the value(SRM Custom field value).
    Hope this information will be useful to you.
    Regards,
    Mani.
    Please assign points for usefull answers
    Message was edited by: Mani Sreedharala

  • XmlBeans and user defined interface...Does it work within WLW?

    I'm attempting to build an xmlbean with a user defined interface that our xmlbean ( derived from our xsd) will implement.
    <br><br>
    I have tried this using the samples from the Apache Xmlbean project ( v1.0.4 ) and the BEA version; both have worked.
    <br><br>
    I was wondering if anyone has attempted this and managed to achieve success using this via the WLW build process.
    <br><br>
    I have removed the reference to the our xmlbean within the handler and used the com.bea.xml.XmlBean reference. This worked with both apache and BEA tests. This also reduces the need for a circular build process ( ugly at best! )
    <br><br>
    I get the following error message:
    <br><br>
    <b>
    ERROR: localInfo.xsdconfig:35: Interface 'com.extension.weatherExtension' not found.
    ERROR: localInfo.xsdconfig:35: Interface 'com.extension.weatherExtensionHandler' not found.
    </b>
    <br><br>
    It woud seem that i am missing the java classes fromthe classpath....however i echo out the classpath during the build and my compiled jar is there.
    <br><br>
    Any thoughts?
    <br><br>
    Thanks

    Andy,
    Let me see if I can help.
    Groups A and B and assigned to group C. That means members of group A are also members of group C. Members of group B are also members of group C.
    However members of group C are only members of group C. So any roles you assign to group A apply only to group A. Likewise with B, roles assigned to group B apply only to group B.
    Now, assign a role to group C and members of groups A, B, and C have that role. So assign general roles to group C and more specific ones to groups A and B.
       C-role 1
    A    B-role 2
    Carl is assigned to group C so he has role 1.
    Brenda is assigned to group B so she has roles 1 and 2.
    Does this help?
    -Michael
    Message was edited by: Michael Shea

  • How to Pass User-defined Parameters from Forms to Reports

    Hi!I am trying to launch an existing report from a form then spool it into a PDF file. I have been successful in passing the report properties using SET_REPORT_OBJECT_PROPERTY built-in and I am also able to launch the report using RUN_REPORT_OBJECT built-in. My problem is, I cannot seem to pass the user defined parameters from my form to the report eventhough I am using the same variable names.
    this is a part of my code:
    repid := Find_Report_Object('ACPPRACS');
    Set_Report_Object_Property(repid, REPORT_EXECUTION_MODE,BATCH);
    Set_Report_Object_Property(repid, REPORT_DESTYPE,FILE);
    Set_Report_Object_Property(repid, REPORT_DESNAME,'C:\TMP\ACS01.PDF');
    Set_Report_Object_Property(repid, REPORT_DESFORMAT,'PDF');
    Set_Report_Object_Property(repid, REPORT_OTHER,'PF_NBO_CD='&#0124; &#0124;'"'&#0124; &#0124;:acs.nbo&#0124; &#0124;'"');
    v_rep := RUN_REPORT_OBJECT(repid);
    Hope you can help me soon. Thanks!

    first of all u will create a paramlist
    then add_paramter to this list
    and then pass this list to the report
    by using run_product.
    i think this is all.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jenny ([email protected]):
    Hi!I am trying to launch an existing report from a form then spool it into a PDF file. I have been successful in passing the report properties using SET_REPORT_OBJECT_PROPERTY built-in and I am also able to launch the report using RUN_REPORT_OBJECT built-in. My problem is, I cannot seem to pass the user defined parameters from my form to the report eventhough I am using the same variable names.
    this is a part of my code:
    repid := Find_Report_Object('ACPPRACS');
    Set_Report_Object_Property(repid, REPORT_EXECUTION_MODE,BATCH);
    Set_Report_Object_Property(repid, REPORT_DESTYPE,FILE);
    Set_Report_Object_Property(repid, REPORT_DESNAME,'C:\TMP\ACS01.PDF');
    Set_Report_Object_Property(repid, REPORT_DESFORMAT,'PDF');
    Set_Report_Object_Property(repid, REPORT_OTHER,'PF_NBO_CD='| |'"'| |:acs.nbo| |'"');
    v_rep := RUN_REPORT_OBJECT(repid);
    Hope you can help me soon. Thanks!<HR></BLOCKQUOTE>
    null

  • Transfer user defined object between 2 databaeses

    i have created a user defined object in my local db.
    i need to import it to the companies server.
    what should i do ?

    If you are talking about the definition - you can use the Copy Express Add-On from SAP.
    Regards

  • Import user defined class in JSP page

    In my test.jsp page, I tried to display the user name using the value returned from a class UserInfo's static function getUsername(), like this:
    <%@page import="toystore.view.UserInfo" %>
    <html:text property="username" value="<%= UserInfo.getUsername()%>"
    Is this allowed? I tried to run it but failed, it complained:
    OracleJSP: oracle.jsp.provider.JspCompileException:
    Errors compiling:D:\java\bc4jtoystore\ToyStoreController\classes\.jsps\_web_2d_inf\_jsp\_signin.java
    Line # Error
    0 cannot access class toystore.view.UserInfo; file toystore\view\UserInfo.class not found
    64 variable UserInfo not found in class web2d_inf._jsp._signin
    If it is allowed, what is the correct way to do it?
    Thanks.
    P.S. UserInfo is compiled in toystore.view package.

    check your classpath. it looke like the compilers complaining that it can't locate your toy store package location not that there is a problem with your jsp. Hope this helps

  • How to use user-defined packages in JAX-RPC web service

    I am trying to use Object of my class located in my package in jax-rpc webservice,the code is
    package supercomputer;
    import Hello.*;
    public class SuperImpl implements SuperIF
    public String sendParam(String data)
    Temp ob=new Temp();
    int i=ob.get1(10000);
    return data+"returned by supercomputer";
    Temp is located in Hello package,I have jar the Hello package as Hello.jar and has set its classpath in targets.xml of Ant tool.
    The code compiles well and service is deployed successfully,but when i try to call the service from the client its gives me following error.
    [echo] Running the supercomputer.SuperClient program....
    [java] java.rmi.ServerException: Missing port information
    [java] at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:357)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
    [java] at supercomputer.SuperIF_Stub.sendParam(SuperIF_Stub.java:60)
    [java] at supercomputer.SuperClient.main(Unknown Source)
    I dont know if it deploys why it gives error on client side.
    Please tell how to use user-defined packages and class in jax-rpc service code ,i am not talking about passing user-defined parameters i am just talking about making objects of user defined classes in jax-rpc service.I think there is some problem in classpath.
    Please guide me in doing that.
    Thanks,
    Farrukh

    Farrukh,
    I don't know if your error is about a missing class from your custom package, ... what track did you followed to say that?
    To use your package in the implementation of you web service, you should only follow the rules of making a web application: put your package jar in your \lib directory inside WEB-INF/ or your package classes unjared in classes (also in WEB-INF/).
    As I already said, I have doubts that your error should be originated from a missing class from your package, but:
    -try to see the logs (errors?) when you deploy your web service that could give a hint about the problem.
    -try to see if you can access your endpoint through your browser to see if there is a online status
    -display your config/WSDL file, and the steps you did to build your web service.
    regards,
    Pedro Salazar.

  • Access result set in user define type of table

    here is the situation. I have a stored procedure that dequeues messages of a AQ and passes them as an OUT parameter in a collection of a user defined type. The same type used to define the queues. The java code executes properly but seems like we don't/can't access the result set. We don't receive any erros but don't know how to access the results. I've included relevant parts of the problem.
    I know this should be doable but........Can someone please tell us what we are doing wrong....thanks in advance.
    -----create object type
    create type evt_ot as object(
    table_name varchar(40),
    table_data varchar(4000));
    ---create table of object types.
    create type msg_evt_table is table of evt_ot;
    ----create queue table with object type
    begin
    DBMS_AQADM.CREATE_QUEUE_TABLE (
    Queue_table => 'etlload.aq_qtt_text',
    Queue_payload_type => 'etlload.evt_ot');
    end;
    ---create queues.
    begin
    DBMS_AQADM.CREATE_QUEUE (
    Queue_name => 'etlload.aq_text_que',
    Queue_table => 'etlload.aq_qtt_text');
    end;
    Rem
    Rem Starting the queues and enable both enqueue and dequeue
    Rem
    EXECUTE DBMS_AQADM.START_QUEUE (Queue_name => 'etlload.aq_text_que');
    ----create procedure to dequeue an array and pass it OUT using msg_evt_table ---type collection.
    create or replace procedure test_aq_q (
    i_array_size in number ,
    o_array_size out number ,
    text1 out msg_evt_table) is
    begin
    DECLARE
    message_properties_array dbms_aq.message_properties_array_t :=
    dbms_aq.message_properties_array_t();
    msgid_array dbms_aq.msgid_array_t;
    dequeue_options dbms_aq.dequeue_options_t;
    message etlload.msg_evt_table;
    id pls_integer := 0;
    retval pls_integer := 0;
    total_retval pls_integer := 0;
    ctr number :=0;
    havedata boolean :=true;
    java_exp exception;
    no_messages exception;
    pragma EXCEPTION_INIT (java_exp, -24197);
    pragma exception_init (no_messages, -25228);
    BEGIN
    DBMS_OUTPUT.ENABLE (20000);
    dequeue_options.wait :=0;
    dequeue_options.correlation := 'event' ;
    id := i_array_size;
    -- Dequeue this message from AQ queue using DBMS_AQ package
    begin
    retval := dbms_aq.dequeue_array(
    queue_name => 'etlload.aq_text_que',
    dequeue_options => dequeue_options,
    array_size => id,
    message_properties_array => message_properties_array,
    payload_array => message,
    msgid_array => msgid_array);
    text1 := message;
    o_array_size := retval;
    EXCEPTION
    WHEN java_exp THEN
    dbms_output.put_line('exception information:');
    WHEN no_messages THEN
    havedata := false;
    o_array_size := 0;
    end;
    end;
    END;
    ----below is the java code....
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Struct;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    public class TestOracleArray {
         private final String SQL = "{call etlload.test_aq_q(?,?,?)}";//array size, var name for return value, MessageEventTable
         private final String driverClass = "oracle.jdbc.driver.OracleDriver";
         private final String serverName = "OurServerName";
         private final String port = "1500";
         private final String sid = "OurSid";
         private final String userId = "OurUser";
         private final String pwd = "OurPwd";
         Connection conn = null;
         public static void main(String[] args){
              TestOracleArray toa = new TestOracleArray();
              try {
                   toa.go();
              } catch (InstantiationException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IllegalAccessException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (SQLException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         private void go() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException{
              Class.forName(driverClass).newInstance();
              String url = "jdbc:oracle:thin:@"+serverName+":"+port+":"+sid;
              conn = DriverManager.getConnection(url,userId,pwd);
              OracleCallableStatement stmt = (OracleCallableStatement)conn.prepareCall(SQL);
              //set 1 input
              stmt.setInt(1, 50);
              //register out 1
              stmt.registerOutParameter(2, OracleTypes.NUMERIC);
              //register out 2
              stmt.registerOutParameter(3, OracleTypes.ARRAY, "MSG_EVT_TABLE");
              * This code returns a non-null ResultSet but there is no data in the ResultSet
              * ResultSet rs = stmt.executeQuery();
              * rs.close();
              * Tried all sorts of combinations of getXXXX(1);
              * All return the same error Message: Invalid column index
              * So it appears that the execute statment returns no data.
              stmt.execute();
              Struct myObject = (Struct)stmt.getObject(1);
              stmt.close();
              conn.close();
    }

    Hi,
    Sorry but I'd refer you to the following sections (and code samples/snippets) in my book:
    Mapping User-Defined Object Types (AD) to oracle.sql.STRUCT in section 3.3, shows how to pass user defined types as IN, OUT,IN/OUT
    JMS over Streams/AQ in the Database: shows how to consume AQ
    message paylod in section 4.2.4
    CorporateOnine, in section 17.2, show how to exchanges user defined type objects b/w AQ and JMS
    All these will hopefully help you achieve what you are trying to do.
    Kuassi

  • User-defined Report Parameters

    I am creating a report in Reports Developer 6i and deploying it to the Web in a pdf format. I need to pass user-defined parameters to the report without hard-coding the parameter values in the http call. Is there a way to do this?
    Thanks,
    Jenny

    1) Create user defined parameters in builder
    2) While running in web give paramform=yes. This will cause paramform to be displayed and user can enter the values
    Thanks
    The Oracle Reports Team

  • User Defined methods

    Hi,
    I have a query as to where are the user defined methos in jsp/servlets are stored after compilation.
    and in a given jsp page 1.jsp when i include 2 files (2.jsp and 3.jsp). so when the 1.jsp gets loaded then in all how much total .class files get created?
    Thanks

    Sounds like homework question. At least I don't stop you from looking in the class folder yourself.

  • User defined function to find difference between dates

    format of dtActivityStartDate/dtActivityFinishDate: 2010-09-17 14:50:51.150
    usdFuncTimeCalc (vcActivityName,dtActivityStartDate, dtActivityFinishDate) -- user defined function
    i need to calculate time elapsed for that type of activity following are the rules:
    (If Process Request is the activity)
    Working Days: Monday through Saturday
    Hours of Operation: 9AM – 5PM
    only working hours of day need to the counted like for example if it is sep 15 11 Am is dtActivityStartDate & Sep 17 is dtActivityFinishDate is 10 Am. then time elapsed is 11am to 5pm on sep 15 , 9 to 5 on sep 16 & 9 to 10 on sep 17 so total should be
    6+ 8 + 1 = 15 hours + minutes.
    format of date time: 2010-09-17 14:50:51.150
    vcActivityName = Process Request
    Don't worry about process request...

    I hv modified the code to make it more generic inorder to suit any timings (customizable) from Monday - Saturday.
    declare
      -- ** b u s i n e s s _ h o u r s **
      -- business_hours returns the number of work houts (9 am through 5 pm,
      -- Monday through Saturday) between in_start_dt and in_end_dt.
      -- If in_start_dt > in_end_dt, the results will be <= 0.
      -- Holidays are not considered.
      in_start_dt DATE := to_date('15-SEP-2010 11:00:00','DD-MON-RRRR HH24:MI:SS');
      in_end_dt   DATE := to_date('17-SEP-2010 10:00:00','DD-MON-RRRR HH24:MI:SS');
      d          NUMBER; -- Hours of either start_dt or end_dt after midnight
      end_dt     DATE := GREATEST(in_start_dt, in_end_dt); -- In case dates were in wrong order
      return_val NUMBER; -- Total number of working hours
      start_dt   DATE := LEAST(in_start_dt, in_end_dt); -- In case dates were in wrong order
      start_time number := 9;
      end_time   number := 17;
    BEGIN
      WITH all_days AS(
        SELECT start_dt + LEVEL - 1 AS a_dt
          FROM dual
        CONNECT BY LEVEL <= 1 + TRUNC(end_dt) - TRUNC(start_dt))
          --SELECT SUM(12)
           SELECT SUM(end_time-start_time)
            INTO return_val
            FROM all_days
           WHERE TO_CHAR(a_dt,'Dy','NLS_DATE_LANGUAGE = ''ENGLISH''') NOT IN ('Sun');
      dbms_output.put_line('Return_Val_1 : '||return_val);
      -- Adjust hours from start_dt, if necessary
      IF TO_CHAR(start_dt, 'Dy', 'NLS_DATE_LANGUAGE = ''ENGLISH''') NOT IN ('Sun') THEN
         -- Calculate nbr of hours passed from midnight
         d := 24 * (start_dt - TRUNC(start_dt));
         dbms_output.put_line('d:'||d);
         IF d >= end_time THEN -- d has passed 5 PM (end_time)
            -- Don't count start_dt if it has passed the closing hours
            return_val := return_val - (end_time-start_time);
            dbms_output.put_line('if-d:'||return_val);
         ELSIF d > start_time and d < end_time THEN -- d has passed 9 AM but less than 5 PM
            -- Don't count the part of start_dt which has passed the opening hours
            return_val := return_val - (d - start_time);
            dbms_output.put_line('else-d:'||return_val);
         END IF;
      END IF;
      dbms_output.put_line('');
      dbms_output.put_line('Return_Val_2 : '||return_val);
      -- Adjust hours from end_dt, if necessary
      IF TO_CHAR(end_dt, 'Dy', 'NLS_DATE_LANGUAGE = ''ENGLISH''') NOT IN ('Sun') THEN
         d := 24 * (end_dt - TRUNC(end_dt));
         dbms_output.put_line('d:'||d);
        IF d <= 9 THEN -- d < 9 AM
           -- Don't count end_dt itself
           return_val := return_val - (end_time-start_time);
           dbms_output.put_line('if-d:'||return_val);
        ELSIF d > start_time and d < end_time THEN -- d > 5 PM
          -- Don't count part of end_dt
          return_val := return_val - (end_time - d);
          dbms_output.put_line('else-d:'||return_val);
        END IF;
      END IF;
      dbms_output.put_line('');
      dbms_output.put_line('Return_Val_3 : '||return_val);
      IF in_start_dt > in_end_dt THEN
          return_val := -return_val;
      END IF;
      dbms_output.put_line('');
      dbms_output.put_line('Return_Val_4 : '||return_val);
    END;Plz note the following points of the code :
    1) You'll need to convert it a function, I just made it a declare..begin..end; block.
    2) I hv used the same timings for start & end as you hv mentioned.
    3) The 2 variables "start_time" and "end_time" take the opening & closing business hours respectively in a 24 hour format.
    4) You might want to remove the DBMS_OUTPUT ... stmts which I had added for debugging.
    It was an interesting code block to analyze ... :-)

  • Pass an array of a user defined class to a stored procedure in java

    Hi All,
    I am trying to pass an array of a user defined class as an input parameter to a stored procedure. So far i have done the following:
    Step 1: created an object type.
    CREATE TYPE department_type AS OBJECT (
    DNO NUMBER (10),
    NAME VARCHAR2 (50),
    LOCATION VARCHAR2 (50)
    Step 2: created a varray of the above type.
    CREATE TYPE dept_array1 AS TABLE OF department_type;
    Step 3:Created a package to insert the records.
    CREATE OR REPLACE PACKAGE objecttype
    AS
    PROCEDURE insert_object (d dept_array);
    END objecttype;
    CREATE OR REPLACE PACKAGE BODY objecttype
    AS
    PROCEDURE insert_object (d dept_array)
    AS
    BEGIN
    FOR i IN d.FIRST .. d.LAST
    LOOP
    INSERT INTO department
    VALUES (d (i).dno,d (i).name,d (i).location);
    END LOOP;
    END insert_object;
    END objecttype;
    Step 4:Created a java class to map the columns of the object type.
    public class Department
    private double DNO;
    private String Name;
    private String Loation;
    public void setDNO(double DNO)
    this.DNO = DNO;
    public double getDNO()
    return DNO;
    public void setName(String Name)
    this.Name = Name;
    public String getName()
    return Name;
    public void setLoation(String Loation)
    this.Loation = Loation;
    public String getLoation()
    return Loation;
    Step 5: created a method to call the stored procedure.
    public static void main(String arg[]){
    try{
    Department d1 = new Department();
    d1.setDNO(1); d1.setName("Accounts"); d1.setLoation("LHR");
    Department d2 = new Department();
    d2.setDNO(2); d2.setName("HR"); d2.setLoation("ISB");
    Department[] deptArray = {d1,d2};
    OracleCallableStatement callStatement = null;
    DBConnection dbConnection= DBConnection.getInstance();
    Connection cn = dbConnection.getDBConnection(false); //using a framework to get connections
    ArrayDescriptor arrayDept = ArrayDescriptor.createDescriptor("DEPT_ARRAY", cn);
    ARRAY deptArrayObject = new ARRAY(arrayDept, cn, deptArray); //I get an SQLException here
    callStatement = (OracleCallableStatement)cn.prepareCall("{call objecttype.insert_object(?)}");
    ((OracleCallableStatement)callStatement).setArray(1, deptArrayObject);
    callStatement.executeUpdate();
    cn.commit();
    catch(Exception e){ 
    System.out.println(e.toString());
    I get the following exception:
    java.sql.SQLException: Fail to convert to internal representation
    My question is can I pass an array to a stored procedure like this and if so please help me reslove the exception.
    Thank you in advance.

    OK I am back again and seems like talking to myself. Anyways i had a talk with one of the java developers in my team and he said that making an array of structs is not much use to them as they already have a java bean/VO class defined and they want to send an array of its objects to the database not structs so I made the following changes to their java class. (Again hoping some one will find this useful).
    Setp1: I implemented the SQLData interface on the department VO class.
    import java.sql.SQLData;
    import java.sql.SQLOutput;
    import java.sql.SQLInput;
    import java.sql.SQLException;
    public class Department implements SQLData
    private double DNO;
    private String Name;
    private String Location;
    public void setDNO(double DNO)
    this.DNO = DNO;
    public double getDNO()
    return DNO;
    public void setName(String Name)
    this.Name = Name;
    public String getName()
    return Name;
    public void setLocation(String Location)
    this.Location = Location;
    public String getLoation()
    return Location;
    public void readSQL(SQLInput stream, String typeName)throws SQLException
    public void writeSQL(SQLOutput stream)throws SQLException
    stream.writeDouble(this.DNO);
    stream.writeString(this.Name);
    stream.writeString(this.Location);
    public String getSQLTypeName() throws SQLException
    return "DOCCOMPLY.DEPARTMENT_TYPE";
    Step 2: I made the following changes to the main method.
    public static void main(String arg[]){
    try{
    Department d1 = new Department();
    d1.setDNO(1);
    d1.setName("CPM");
    d1.setLocation("LHR");
    Department d2 = new Department();
    d2.setDNO(2);
    d2.setName("Admin");
    d2.setLocation("ISB");
    Department[] deptArray = {d1,d2};
    OracleCallableStatement callStatement = null;
    DBConnection dbConnection= DBConnection.getInstance();
    Connection cn = dbConnection.getDBConnection(false);
    ArrayDescriptor arrayDept = ArrayDescriptor.createDescriptor("DEPT_ARRAY", cn);
    ARRAY deptArrayObject = new ARRAY(arrayDept, cn, deptArray);
    callStatement = (OracleCallableStatement)cn.prepareCall("{call objecttype.insert_array_object(?)}");
    ((OracleCallableStatement)callStatement).setArray(1, deptArrayObject);
    callStatement.executeUpdate();
    cn.commit();
    catch(Exception e){
    System.out.println(e.toString());
    and it started working no more SQLException. (The changes to the department class were done manfully but they tell me JPublisher would have been better).
    Regards,
    Shiraz

  • How to pass external input to user-defined subclasses

    Hi all,
    [this might be a really trivial question] I would like to define a sub-
    class of JTable which get some external inputs: something similar to
    the following *not-working* example.
    *********************************************************************** import javax.swing.*;
    import javax.swing.table.*;
    public class RHJTable extends JTable
        public RHJTable(int rows, int columns, int externalinput)
            super(rows, columns);
        public Object getValueAt(int row, int column, int externalinput)
            return externalinput;
    What follows is the error message I get, which I assume it is due to
    my "externalinput":
    ??? Java exception occurred:
    java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
    at java.util.Vector.elementAt(Unknown Source)
    at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown
    Source)
    at javax.swing.JTable.getCellRect(Unknown Source)
    at javax.swing.JTable.valueChanged(Unknown Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.changeSelection(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.changeSelection(Unknown
    Source)
    at
    javax.swing.DefaultListSelectionModel.removeSelectionIntervalImpl(Unkno
    wn Source)
    at
    javax.swing.DefaultListSelectionModel.removeSelectionInterval(Unknown
    Source)
    at javax.swing.JTable.checkLeadAnchor(Unknown Source)
    at javax.swing.JTable.tableChanged(Unknown Source)
    at javax.swing.JTable.setModel(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at RHJTable.<init>(RHJTable.java:12)
    Can anybody please suggest me the correct way of passing this external
    input?
    Thanks
    lor

    Thanks for this detail. Before getting into JTable
    etc...design suggestions, it would be helpful to know
    how the interaction between Java and MATLAB is
    supposed to proceed. OK: I'm developing a MATLAB GUI with an embedded JTable inside it: people write things in a user defined JTable (well, customized subclass of JTable).
    I would like to define this subclass not as MyJTable(int rows, int cols) but as MyJTable(int rows, int cols, int externalinput), but doing this gives me the aformentioned error.
    Simplest setting: MATLAB writes data to a file, and
    knowing the format of that file you are able to parse
    it in Java. I'm not using any kind of input or output file: simply, MATLAB calls a JTable subclass (i.e. I only have a .class file to work on).
    Problem arises when I would like to add some more input: I cannot say simply setValueAt(int externalinput) if the JTable can't get this input directly from MATLAB...
    I hope I did make myself a little bit more clear: solution must be trivial, but I'm spending a lot of time in it...
    Thank you very much for your interest.
    lor

Maybe you are looking for