How to call a PL/SQL procedure from a Java class?

Hi,
I am new to the E-BusinessSuite and I want to develop a Portal with Java Portlets which display and write data from some E-Business databases (e.g. Customer Relationship Management or Human Resource). These data have been defined in the TCA (Trading Community Architecture) data model. I can access this data with PL/SQL API's. The next problem is how to get the data in the Java class. So, how do you call a PL/SQL procedure from a Java program?
Can anyone let me know how to solve that problem?
Thanks in advance,
Chang Si Chou

Have a look at this example:
final ApplicationModule am = panelBinding.getApplicationModule();
try
     final CallableStatement stmt = ((DBTransaction)am.getTransaction()).
                                                                                     createCallableStatement("{? = call some_pck.some_function(?, ?)}", 10);
     stmt.registerOutParameter(1, OracleTypes.VARCHAR);
     stmt.setInt(2, ((oracle.jbo.domain.Number)key.getAttribute(0)).intValue());
     stmt.setString(3, "Test");
     stmt.execute();
     stmt.close();
     return stmt.getString(1);
catch (Exception ex)
     panelBinding.reportException(ex);
     return null;
}Hope This Helps

Similar Messages

  • How to call a PL/SQL procedure from Portal

    Env.Info: Windows NT Server 4 (Service Pack 3) / Oracle 8i R3 EE / Oracle Portal 3.0 Production.
    I created a new schema "BISAPPS" and created a user with the same name. Ran provsyns.sql script to grant Portal API access. Created a new package under this new schema and compiled it against the database. After that I registered the schema as a portal provider. There were no errors.
    Now I logged into Portal using the account PORTAL30. Refreshed the portlet repository and the new portlets appeared. I added the new portlet to the page. It is displayed successfully.
    New portlet allows the user to enter a bug-number and lets the user to either view or edit. If the user clicks on the button "Edit", it opens a new window and displays the contents from BugDB application. But if the user clicks on "Show", it should display the output generated by a PL/SQL procedure (Owned by the above New Schema - BISAPPS) in a separate window. But instead it is displaying the following error in the separate window:
    bisapps_pkg.buginfo: PROCEDURE DOESN'T EXIST.
    DAD name: PORTAL30
    PROCEDURE : bisapps_pkg.buginfo
    URL : http://host_name:80/pls/portal30/bisapps_pkg.buginfo
    And list of environment variables ....
    Can anyone help me? How can I call a PL/SQL procedure when the button is clicked? Thanks in advance.

    You must grant EXECUTE privilege on your procedure to the PORTAL30_PUBLIC user. If the error still persists, create a PUBLIC synonym for your procedure.

  • Calling pl/sql procedure from a java class.

    I have an onSubmit event that needs to call a pl/sql procedure using the named connection. Can anyone tell me how this is code in a Model 1 ADF JSP page?

    Look at the following related thread:
    Programatically setting attribute values.

  • How to call a PL/SQL procedure from a xml Data Template

    We have a requirement in which we need to call a pl/sql package.(dot)procedure from a Data Template of XML Publisher.
    we have registered a Data Template & a RTF Template in the XML Publisher Responsibility in the Oracle 11.5.10 instance(Front End).
    In the Data Query part of the Data Template , we have to get the data from a Custom View.
    This view needs to be populated by a PL/SQL procedure.And this procedure needs to be called from this Data Template only.
    Can anybody suggest the solution.
    Thanks,
    Sachin

    Call the procecure in the After Parameter Form trigger, which can be scripted in the Data Template.
    BTW, there is a specialized XML Publisher forum:
    BI Publisher

  • How to call a PL/SQL Procedure from a Report Column Hyperlink

    Hallo!
    Normally a link on a column value in a report leads you to a page in your application or to another URL.
    And you can send the value of this cell to the calling page.
    I want, that oracle executes a procedure with the values as in-Parameters if I click on this hyperlink.
    Must I call a dummy page and define this procedure in the header of this page or exit there other ways?
    Can you give ma an example?
    Thanks a lot!
    Gerhard

    Paul - When a column link is used to invoke a On Demand Process in that way, wouldn't that result in a blank page (unless of course the ODP emits a well-formed HTML document)? You could set the link target to a no-op like *#* and use a onclick handler in the Link Attributes to call a Javascript that uses the htmldb_get object to call the ODP. In fact, I don't think I have ever seen a ODP used in any other context.

  • How can I call a pop up window from a java class ?

    Hi,
    I am developing a web app. I would like to call a windoz pop up from a java class.
    How can i do that ?
    Thanks

    user504072 wrote:
    It was possible to do it in ASP .NET even from the server side with the method Page.ClientScript. What do you think what Page.ClientScript stands for?
    I's an encapsulation for the JavaScript code required and hides the separation between frontend and backend. There was a reason why so many developers stick to the MVC-pattern wich ist violated here.
    I did not know it is not possible to do the same thing in Java.I'ts not a task of the backend to layout the user interaction GUI.
    bye
    TPD

  • Error when try to call a pl/sql procedure from the .xsql file

    I tried to call a pl/sql procedure like this:
    <?xml version="1.0"?>
    <page connection="omtest5" xmlns:xsql="urn:oracle-xsql">
    <xsql:include-owa>
    sampleowaxml.testone
    </xsql:include-owa>
    </page>
    but I got the following error message:
    <?xml version="1.0" ?>
    - <page>
    - <xsql-error action="xsql:include-owa">
    <statement>declare buf htp.htbuf_arr; param_names owa.vc_arr; param_values owa.vc_arr; rows integer := 32767; outclob CLOB;begin param_names(1) := 'HTTP_COOKIE'; param_values(1) := ''; param_names(2) := 'SERVER_NAME'; param_values(2) := 'mxfang-nt.us.oracle.com'; param_names(3) := 'SERVER_PORT'; param_values(3) := '80'; param_names(4) := 'SCRIPT_NAME'; param_values(4) := '/servlets/oracle.xml.xsql.XSQLServlet'; param_names(5) := 'PATH_INFO'; param_values(5) := '/xsql/test/myproject.xsql'; param_names(6) := 'HTTP_USER_AGENT'; param_values(6) := 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)'; owa.init_cgi_env(6,param_names,param_values); sampleowaxml.testone owa.get_page(buf,rows); dbms_lob.createtemporary(outclob,true,dbms_lob.session); for i in 1..rows loop dbms_lob.writeappend(outclob,length(buf(i)),buf(i)); end loop; ? := outclob; ? := DBMS_LOB.INSTR(outclob,CHR(10)&#0124; &#0124;CHR(10));end;</statement>
    <message>ORA-06550: line 3, column 3: PLS-00103: Encountered the symbol "OWA" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "OWA" to continue.</message>
    </xsql-error>
    - <xsql-error action="xsql:include-owa">
    <message />
    </xsql-error>
    </page>
    This error message is very similiar to the message that Shanthir posted on Jan, 21. I did run the dbmslob.sql, but it doesn't help. Anybody has ideas how to solve it?
    I used the PL/SQL web toolkit provided by OAS4.0.8.1. I believe oracle web agent is replaced by this toolkit.
    Thanks,
    Min
    null

    Hi,
    Glad that somebody else too got this problem. Well, as I had mentioned in my previous posting too, I think there are some procedures in the package, dbms_lob, like the writeappend, createtemporary etc.. which is not found in my dbms_lob.sql file, I am using 8.0.5, but I found these procedures in the 8i, I think it is becos of that.
    By the way if anybody got this solution and got any workaround, please help me too.
    I am still waiting for the solution to that.
    Shanthi

  • Calling PL/SQL function from external Java class

    I was wondering if I was able to call a pl/sql function from an external java class? If so, would you be able to tell me briefly on how to go about it. I know I can call java methods that are internally stored in the db from pl/sql, but I was hoping I could call pl/sql from external java. Thanks,
    Kelly

    Ok, I made the changes, but I'm now getting the following error:
    Error code = 1403
    Error message = ORA-01403: no data found
    ORA-06512: at "IOBOARD.GETSTATUS", line 6
    ORA-06512: at line 1
    The ora-01403 I don't understand because there is data for the name Kelly.Brace.
    ora-06512 error: at string line string.
    Here's what the code looks like after I made the changes:
    String sql = "{?=call ioboard.GetStatus(?)}";
          // create a Statement object
          myStatement = myConnection.prepareCall( sql );
          myStatement.setString( 1, "Kelly.Brace" );
          myStatement.registerOutParameter(2, java.sql.Types.LONGVARCHAR );
          // create a ResultSet object, and populate it with the
          // result of a SELECT statement
          ResultSet myResultSet = myStatement.executeQuery();
          // retrieve the row from the ResultSet using the
          // next() method
          myResultSet.next();
          // retrieve the user from the row in the ResultSet using the
          // getString() method
          String status = myResultSet.getString(1);
          System.out.println("Hello Kelly, your status is: " + status);
          // close this ResultSet object using the close() method
          myResultSet.close();Here's what the function looks like:
    CREATE OR REPLACE FUNCTION GetStatus( user_name in varchar2)
    RETURN VARCHAR2
    is
    v_status varchar2(10);
    BEGIN
    select iob_location into v_status
    from ioboard.iob_user
    where iob_username = user_name;
      RETURN( v_status);
    END;This works perfectly in the SQL Window:
    select iob_location
    from ioboard.iob_user
    where iob_username = 'Kelly.Brace';

  • How to Run a .sql file from simple java class

    How to execute a .sql file consisting of Complex Queries,procedures through simple java class.
    The queries may have different delimiters,queries independant of each other.
    I am able to do with Specific De-limiter.But I need in such a way that there should not be any
    Constraints. Since My .sql may Contain different De-limiters.
    If any one can Suggest Some Solution.
    It will be Great Help.
    regards
    Anil

    Check out ibatis script runner, it' a third party library but quite handy for running sql files...
    m

  • How to interact with a COM component from a Java class

    Hi, could someone give a hint on what API I should explore in order to interact with a COM component from a Java class?
    Thanks in advance
    Luis

    jacob sounds nice...http://danadler.com/jacob/

  • How to call a Oracle Stored Procedure from Excel?

    Hi,
    I am new to Oracle database programming.I have an application in excel which has to update info in every row to the database.I am calling a stored procedure in excel for this.The stored procedure is as follows which is executing without a hitch in Oracle:
    CREATE OR REPLACE PROCEDURE APD_MASS_UPLOAD_UNITS
    (PRODUCT_ID VARCHAR2,Product_Code VARCHAR2, str_Adpt_Grp VARCHAR2,str_Adpt_Type VARCHAR2,
    str_PDC VARCHAR2,str_Release_ID VARCHAR2,str_Created_by VARCHAR2,
    str_Last_Updated_By VARCHAR2, dt_created_Date VARCHAR2,dt_Last_Updated_Date VARCHAR2,
    StrMonth1 VARCHAR2,strMth2 VARCHAR2,StrMth3 VARCHAR2,StrMth4 VARCHAR2,
    StrMth5 VARCHAR2,StrMth6 VARCHAR2,Sample Varchar2,str_message OUT Varchar2)
    AS
    type Month_type is table of VARCHAR2(10) index by binary_integer;
    str_month Month_Type;
    Fac_ID VARCHAR2(20);
    Org_ID VARCHAR2(20);
    Cnt_Units NUMBER;
    i_POS NUMBER;
    i_Month NUMBER;
    i_UNITS NUMBER;
    CURSOR C1 IS
    SELECT * FROM TBLLINE_ADOPT_PLAN WHERE SPEC_ID = Product_ID AND
    ADOPT_GROUP = str_Adpt_Grp AND ADOPT_TYPE = str_Adpt_Type
    AND RELEASE_ID = APD_Get_Release_ID(str_PDC,str_Release_Id);
    CURSOR C2 IS
    SELECT FACILITY_ID FROM TBLADOPT_GROUP_CSC WHERE ADOPT_GROUP = str_Adpt_Grp;
    CURSOR C3 IS
    SELECT ORG_ID FROM APD_DV_PRODUCT_V WHERE SPEC_ID = Product_ID;
    CURSOR C4 IS
    SELECT * FROM TBLPROD_CSC WHERE PROD_SPEC_ID = Product_ID;
    Adopt_Rec C1%ROWTYPE;
    Fac_Rec C2%ROWTYPE;
    PMORG_REC C3%ROWTYPE;
    CSC_Rec C4%ROWTYPE;
    i_Count NUMBER;
    Message VARCHAR2(20);
    BEGIN
    Message := APD_SPECID_VALIDATE(Product_ID,Product_code,Str_PDC, str_Release_ID);
    IF TRIM(Message) is null then
    OPEN C1;
    FETCH C1 INTO Adopt_Rec;
    IF C1%NOTFOUND THEN
    INSERT INTO TBLLINE_ADOPT_PLAN (SPEC_ID,ADOPT_GROUP, ADOPT_TYPE,RELEASE_ID, SAMPLES,CREATED_BY,CREATED_DATE, LAST_UPDATED_BY,LAST_UPDATED_DATE,SAMPLE_ONLY_IND, GRID_TYPE_CD) VALUES
    (Product_ID,str_Adpt_Grp ,str_Adpt_Type,
    APD_Get_Release_ID(str_PDC,str_Release_Id), 0,str_Created_By,
    TO_DATE(dt_Created_Date,'DD/MM/YYYY'),str_Last_Updated_By,
    TO_DATE(dt_Last_Updated_Date,'DD/MM/YYYY'),'N','C');
    END IF;
    CLOSE C1;
    str_Month(1) := strMonth1;
    str_Month(2) := strMth2;
    str_Month(3) := strMth3;
    str_Month(4) := strMth4;
    str_Month(5) := strMth5;
    str_Month(6) := strMth6;
    OPEN C2;
    FETCH C2 INTO Fac_REC;
    Fac_ID := Fac_Rec.FACILITY_ID;
    CLOSE C2;
    OPEN C3;
    FETCH C3 INTO PMORG_Rec;
    Org_ID := PMORG_Rec.Org_ID;
    CLOSE C3;
    OPEN C4;
    FETCH C4 INTO CSC_Rec;
    IF C4%NOTFOUND THEN
    INSERT INTO TBLPROD_CSC(PROD_SPEC_ID,CSC_FACILITY_ID, PROFIT_CENTER_CD,DEFAULT_IND, CREATED_BY, CREATED_DATE, LAST_UPDATED_BY, LAST_UPDATED_DATE) VALUES
    (Product_ID , Fac_ID,Org_id, 'N', str_Created_by ,
    To_date ( dt_Created_Date,'DD/MM/YYYY') ,str_Last_updated_by ,
    To_Date (dt_Last_Updated_Date ,'DD/MM/YYYY'));
    END IF;
    CLOSE C4;
    IF Sample > 0 Then
    UPDATE TBLLINE_ADOPT_PLAN
    SET SAMPLES = Sample
    WHERE SPEC_ID = Product_ID AND
    ADOPT_GROUP = str_adpt_grp AND
    ADOPT_TYPE = str_Adpt_Type AND
    RELEASE_ID = APD_Get_Release_ID(str_PDC,str_Release_Id);
    END IF;
    str_Message := 'Updated';
    END IF;
    END;
    The code to call the stored procedure in Excel is as follows:
    Dim Conn As New ADODB.Connection
    Dim InputParam1 As New ADODB.Parameter
    Dim InputParam2 As New ADODB.Parameter
    Dim InputParam3 As New ADODB.Parameter
    Dim InputParam4 As New ADODB.Parameter
    Dim InputParam5 As New ADODB.Parameter
    Dim InputParam6 As New ADODB.Parameter
    Dim InputParam7 As New ADODB.Parameter
    Dim InputParam8 As New ADODB.Parameter
    Dim InputParam9 As New ADODB.Parameter
    Dim InputParam10 As New ADODB.Parameter
    Dim InputParam11 As New ADODB.Parameter
    Dim InputParam12 As New ADODB.Parameter
    Dim InputParam13 As New ADODB.Parameter
    Dim InputParam14 As New ADODB.Parameter
    Dim InputParam15 As New ADODB.Parameter
    Dim InputParam16 As New ADODB.Parameter
    Dim InputParam17 As New ADODB.Parameter
    Dim InputParam18 As New ADODB.Parameter
    Dim OutputParam As New ADODB.Parameter
    Dim Mth1, Mth2, Mth3, Mth4, Mth5, Mth6 As String
    Dim Rs_data As New ADODB.Recordset
    Conn.ConnectionString = ("Provider=MSDAORA.1;User ID=" & "cnbg" & ";PASSWORD=" & "cnbg" & ";Data Source=" & "DAQ01" & ";Persist Security Info=False")
    Conn.Open
    OraCmd.ActiveConnection = Conn
    OraCmd.CommandText = "APD_MASS_UPLOAD_UNITS"
    OraCmd.CommandType = adCmdStoredProc
    Conn.CursorLocation = adUseClient
    OraCmd.Parameters.Refresh
    Set InputParam1 = OraCmd.CreateParameter("Product_ID", adVarChar, adParamInput, 20)
    InputParam1.Value = spec_id
    Set InputParam2 = OraCmd.CreateParameter("Product_code", adVarChar, adParamInput, 20)
    InputParam2.Value = str_product_code
    Set InputParam3 = OraCmd.CreateParameter("str_Adpt_Type", adVarChar, adParamInput, 10)
    InputParam3.Value = Adopt_Group
    Set InputParam4 = OraCmd.CreateParameter("str_Adpt_Type", adVarChar, adParamInput, 10)
    InputParam4.Value = Adopt_Type
    Set InputParam5 = OraCmd.CreateParameter("str_pdc", adVarChar, adParamInput, 10)
    InputParam5.Value = ThisWorkbook.strDbPDC
    Set InputParam6 = OraCmd.CreateParameter("str_Release_ID", adVarChar, adParamInput, 10)
    InputParam6.Value = str_Release_Id
    Set InputParam7 = OraCmd.CreateParameter("str_created_by", adVarChar, adParamInput, 10)
    InputParam7.Value = ThisWorkbook.User_Name
    Set InputParam8 = OraCmd.CreateParameter("str_last_updated_by", adVarChar, adParamInput, 10)
    InputParam8.Value = ThisWorkbook.User_Name
    Set InputParam9 = OraCmd.CreateParameter("dt_created_date", adVarChar, adParamInput, 10)
    InputParam9.Value = Sheet1.Cells(8, 2)
    Set InputParam10 = OraCmd.CreateParameter("dt_Last_Updated_Date", adVarChar, adParamInput, 10)
    InputParam10.Value = Sheet1.Cells(8, 2)
    Set InputParam11 = OraCmd.CreateParameter("strMonth1", adVarChar, adParamInput, 10)
    InputParam11.Value = Mth1
    Set InputParam12 = OraCmd.CreateParameter("strMth2", adVarChar, adParamInput, 10)
    InputParam12.Value = Mth2
    Set InputParam13 = OraCmd.CreateParameter("strMth3", adVarChar, adParamInput, 10)
    InputParam13.Value = Mth3
    Set InputParam14 = OraCmd.CreateParameter("strMth4", adVarChar, adParamInput, 10)
    InputParam14.Value = Mth4
    Set InputParam15 = OraCmd.CreateParameter("strMth5", adVarChar, adParamInput, 10)
    InputParam15.Value = Mth5
    Set InputParam16 = OraCmd.CreateParameter("strMth6", adVarChar, adParamInput, 10)
    InputParam16.Value = Mth6
    Set InputParam17 = OraCmd.CreateParameter("Sample", adInteger, adParamInput, 10)
    InputParam17.Value = 0
    Set InputParam18 = OraCmd.CreateParameter("str_message", adVarChar, adParamOutput, 10)
    OraCmd.Parameters.Append InputParam1
    OraCmd.Parameters.Append InputParam2
    OraCmd.Parameters.Append InputParam3
    OraCmd.Parameters.Append InputParam4
    OraCmd.Parameters.Append InputParam5
    OraCmd.Parameters.Append InputParam6
    OraCmd.Parameters.Append InputParam7
    OraCmd.Parameters.Append InputParam8
    OraCmd.Parameters.Append InputParam9
    OraCmd.Parameters.Append InputParam10
    OraCmd.Parameters.Append InputParam11
    OraCmd.Parameters.Append InputParam12
    OraCmd.Parameters.Append InputParam13
    OraCmd.Parameters.Append InputParam14
    OraCmd.Parameters.Append InputParam15
    OraCmd.Parameters.Append InputParam16
    OraCmd.Parameters.Append InputParam17
    OraCmd.Parameters.Append InputParam18
    Set Rs_data = New ADODB.Recordset
    Set Rs_data = OraCmd.Execute
    I am getting an error at this point which
    ORA-06550:line 1,column 54:
    PLS-00103:Encountered the symbol ">" when expecting one of the following:
    . ( ) * @ % & = - + < / > at in is mod not rem
    <an exponent(**)> <> or != or ~= or >= <= <> and or like
    between ||
    Can anyone pls help me?Thanks.

    You do not need to code an explicit cursor for a single fetch. An implicit cursor is less code to write, read, maintain and execute.
    E.g. Instead of all this:
    CURSOR C2 IS
    SELECT FACILITY_ID FROM TBLADOPT_GROUP_CSC WHERE ADOPT_GROUP = str_Adpt_Grp;
    OPEN C2;
    FETCH C2 INTO Fac_REC;
    Fac_ID := Fac_Rec.FACILITY_ID;
    CLOSE C2;
    Simply code this:SELECT
    Fac_Rec.FACILITY_ID INTO Fac_ID
    FROM BLADOPT_GROUP_CSC
    WHERE ADOPT_GROUP = str_Adpt_Grp;PL/SQL procedure calls have to be made (to Oracle) as anonymous PL/SQL blocks. This means that you need to wrap the procedure call into BEGIN..END tags.
    So instead of coding this:
    OraCmd.CommandText = "APD_MASS_UPLOAD_UNITS"
    You need to code something like:
    OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS; END;"
    However, this will not work as APD_MASS_UPLOAD_UNITS expects a bunch of input parameters. And you're on the right track about attempting to bind your Excel variables' values to the PL/SQL procedure's parameters.
    Unsure how ADO works, but typically you can bind by name or by position. Let's assume bind by position (typically in PHP):
    OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS( ?, ?, ?, ?, ?. ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); END;"
    Then you will bind values to positions 1 to 18 (did I count the number of params right?). Something like:
    OraCmd.CreateParameterByPosition( 1, adVarChar, adParamInput, 20)
    Or you can bind by name. E.g.
    OraCmd.CommandText = "BEGIN APD_MASS_UPLOAD_UNITS( :pid, :pcode, ..etc.. ); END;"
    And:
    OraCmd.CreateParameterByName( 'pid', adVarChar, adParamInput, 20)
    Read up on your OraCmd.CreateParameter() to see how to correctly use it.
    A few more comments. 18 parameters in a call is something I would seriously reconsider. It is quite easy to get it wrong - transpose two parameters. It is very difficult to read and check. Very difficult to maintain. It is much safer to rather define a %ROWTYPE structure to pass, or a PL/SQL record structure.
    You are passing date values as VARCHAR2. Rather pass the parameter as the correct data type. E.g.
    create or replace procedure foo( custID number, invoiceDate date )...
    And then when you call it (in your client code), you specify the date string and date format and make it into a date. E.g.
    OraCmd.CommandText = "begin foo( :myCust, TO_DATE(:myDateString,:myDateFormat) ); end;"

  • Calling a PL/SQL Procedure from button and then return to same page

    I have a button called "Process" that I want to call the database stored procedure "BUILD_WORKDAYS" with parameters P14_PROCESS_YEAR as an input parameter. I have the button on the page but is this a PL/SQL Page Process or a PL/SQL Branch? I have tried a number of combination but don't seem to be able to get the database procedure to execute. What should the syntax be?
    Thanks

    "I have a button called "Process" that I want to call the database stored procedure "BUILD_WORKDAYS" with parameters P14_PROCESS_YEAR as an input parameter"
    Assuming you are starting with an empty Apex page:
    1) Create a region of some type or other, say HTML.
    2) Create a button of type "Create a button in region position" in this region. Sounds like you've already done this and called it PROCESS.
    3) Create a process of type PL/SQL, On Submit After Computations and Validations.
    4) Call it "Execute BUILD_WORKDAYS" (or whatever you like)
    5) The PL/SQL for the process is:
    BUILD_WORKDAYS(:P14_PROCESS_YEAR);
    6) Specify a success and failure message.
    7) In the final step of the Create Page Process wizard, select your button from the "When button pressed" select list.
    8) Then create an unconditional branch branching to the same page.
    That should be it.
    Andy

  • How to get properties of a bean from another java class

    Hi,
    I am new to JSF. Currently I am facing a problem, and hope you experts can give me some guidance.
    The JSF app i am working on has one Java class for handling a tree structure, MyTreeNode.java, and it also has a bean, NameBean.java, which has two properties, username and password.
    I can easily associate an input text with the #{name.username} to store the user's login... but later on, I need to fetch that information inside of MyTreeNode.java. How do I do that? Thanks!
    -- Jim

    <managed-bean>
         <managed-bean-name>Person</managed-bean-name>
         <managed-bean-class>demo.PersonBean</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
         <managed-property>
              <property-name>bank</property-name>
              <property-class>demo.BankBean</property-class>
              <value>#{bank}</value>
         </managed-property>
    <managed-bean>
    <managed-bean>
         <managed-bean-name>bank</managed-bean-name>
         <managed-bean-class>demo.BankBean</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
    <managed-bean>this version doesnt work for me.
    does the single beans have to look any special?
    some demo code out there?
    thx!

  • How do I debug pl/sql procedures from a bc4j application

    Hi,
    I would like to use jdevelopers pl/sql debugging capabilities to debug some code that is executed by triggers in the database, when inserting records through my bc4j client application.
    I already found the remote debugging feature of jdeveloper, but that requires setting up a separate debugger listener, and it also requires me to put the following statement in the session:
    DBMS_DEBUG_JDWP.CONNECT_TCP ('hostname_or_ip', port_number)
    Where and how can I put this line of pl/sql code to make it execute each time I launch the bc4j application?
    Or is it possible to use one debugger process (the one that's also using the java breakpoints) to debug both pl/sql and java code?
    Greetings,
    Ivo

    I have the same problem.
    I have a PL/SQL function that returns a number. This function receives 2 parameters. I use StoredProcedureCall plus ValueReadQuery.
    Session aSession = SessionManager.getManager().getDefaultSession();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("CIO_UTILS.COUNT_USER_ROLES_IN_MODULE");
    call.addNamedArgument("p_persid");
    call.addNamedArgument("p_module");
    call.addUnamedOutputArgument("rolesnum", Integer.class);
    ValueReadQuery query = new ValueReadQuery();
    //query.bindAllParameters();
    query.setCall(call);
    query.addArgument("p_persid");
    query.addArgument("p_module");
    Vector parameters = new Vector();
    parameters.addElement(persid);
    parameters.addElement(theModule);
    Integer rolesnum = (Integer) aSession.executeQuery(query,parameters);
    aSession.release();
    if(rolesnum.intValue()<=0)return false; else return true;
    However, I receive the following error:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 96:
    PLS-00312: a positional parameter association may not follow a named association
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call:BEGIN CIO_UTILS.COUNT_USER_ROLES_IN_MODULE(p_persid=>'SANCRA2791', p_module=>'PSL_MONITORING', ?); END;
         bind => [=> rolesnum]
    If comment the line
    "call.addUnamedOutputArgument("rolesnum", Integer.class);"
    Toplink is trating it as a procedure, and I also receive an error from PL/SQL.
    There should have to be a way of make it to receive the resoult somehow, but I do not know what.
    Thanks in advance.

  • Unable to call a pl/sql procedure from java

    Software : Oracle 9i & Red hat linux 9
    Code:
    import java.io.*;
    import java.sql.*;
    public class test
    public static void main(String args[])
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.221:1521:elearn","gowri","gowri");
    CallableStatement call=con.prepareCall("{call ins(?,?,?,?)}");
    call.setInt(1,5);
    call.setString(2,"hari");
    call.setString(3,"m");
    call.setString(4,"1976-12-26");
    if ( call.execute() )
    System.out.println("Success");
    else
    System.out.println("fails");
    call.close();
    con.close();
    catch(Exception ex)
    System.out.println("Error :"+ex);
    ~
    ~
    ~
    Stored Procedure:
    create or replace procedure ins(no in number,name in varchar,sex in varchar,dob in varchar)is
    con_day date;
    begin
    con_day=to_date(dob,'yyyy-mm-dd');
    insert into person values(no,name,sex,con_day);
    end;
    Run Time Error:
    Exception in thread "main" java.lang.IncompatibleClassChangeError: oracle.jdbc.driver.OraclePreparedStatement
    at 0x40268e17: java.lang.Throwable.Throwable(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x4025bc8e: java.lang.Error.Error(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x4025d6b6: java.lang.LinkageError.LinkageError(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x4025c7aa: java.lang.IncompatibleClassChangeError.IncompatibleClassChangeError(java.lang.String) (/usr/lib/./libgcj.so.3)
    at 0x40229eed: JvPrepareClass(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x40248028: java.lang.ClassLoader.linkClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x4025acb3: java.lang.ClassLoader.resolveClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x402299cb: JvPrepareClass(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x40248028: java.lang.ClassLoader.linkClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x4025acb3: java.lang.ClassLoader.resolveClass0(java.lang.Class) (/usr/lib/./libgcj.so.3)
    at 0x4024646c: java.lang.Class.initializeClass() (/usr/lib/./libgcj.so.3)
    at 0x40230912: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x40230ff4: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x4022e504: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/./libgcj.so.3)
    at 0x4038305c: ?? (??:0)
    at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
    at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
    at 0x402306e8: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x40230ff4: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x4022e58a: JvInterpMethod.run_synch_object(ffi_cif, void, ffi_raw, void) (/usr/lib/./libgcj.so.3)
    at 0x4038305c: ?? (??:0)
    at 0x403831e7: ffi_call_SYSV (/usr/lib/./libgcj.so.3)
    at 0x403831a7: ffi_raw_call (/usr/lib/./libgcj.so.3)
    at 0x402306e8: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x40230ff4: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/./libgcj.so.3)
    at 0x4022e504: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/./libgcj.so.3)
    at 0x4038305c: ?? (??:0)
    at 0x40242dd8: gnu.gcj.runtime.FirstThread.call_main() (/usr/lib/./libgcj.so.3)
    at 0x402ad02d: gnu.gcj.runtime.FirstThread.run() (/usr/lib/./libgcj.so.3)
    at 0x4024fc4c: JvThreadRun(java.lang.Thread) (/usr/lib/./libgcj.so.3)
    at 0x4021c8ac: JvRunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/./libgcj.so.3)
    at 0x08048910: ?? (??:0)
    at 0x42015574: __libc_start_main (/lib/tls/libc.so.6)
    at 0x080486c1: ?? (??:0)

    Hi Gowrishankar,
    This is just a suggestion (based on a guess). Try changing this line of your code:
    call.setInt(1,5);with this line:
    call.setBigDecimal(1,5);Good Luck,
    Avi.

Maybe you are looking for