Pass date parameters to dataprocessor in Java

Hello I have created java class to execute data templates, but I have problem when I pass date parameters as it was from application dataprocessor fails without any error message and does not return any data (except output xml file header). How to pass date parameters correctly?
import java.sql.*;
import oracle.apps.xdo.dataengine.DataProcessor;
import com.sun.java.util.collections.Hashtable;
class oraConn
public static void main (String args []) throws SQLException
System.out.println("Start");
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
java.util.Properties ora_property = new java.util.Properties();
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:user/pass@host:port:sid");
try {
DataProcessor dataProcessor = new DataProcessor();
dataProcessor.setDataTemplate("/home/user/definition.xml");
Hashtable parameters = new Hashtable();
parameters.put("c_period_start_date","2009/01/01 00:00:00");
parameters.put("c_period_end_date","2009/12/31 00:00:00");
parameters.put("c_employed_before_date","");
parameters.put("c_org_hierarchy","63");
dataProcessor.setParameters(parameters);
dataProcessor.setConnection(conn);
dataProcessor.setOutput("/home/user/Out.xml");
dataProcessor.processData();
} catch (Exception e)
{System.out.println ("Data procesor Fail.");}
} catch (SQLException ex) {
System.out.println ("\n*** SQLException caught ***\n");
while (ex != null) {
System.out.println ("SQLState: " + ex.getSQLState ());
System.out.println ("Message: " + ex.getMessage ());
System.out.println ("Vendor: " + ex.getErrorCode ());
ex.printStackTrace();
ex = ex.getNextException ();
System.out.println ("");
}}}}

Found out solution to my problem. I needed to import date not as string but as Date type.

Similar Messages

  • Problem with passing date parameters in cursor

    Is there any problem in passing date parameters and like clause as below
    CURSOR eftcursor(start_date DATE, end_date DATE, where_clause varchar2) IS
    select * from r_records
    where created_date between start_date and end_date and description like where_clause;
    and in the open statement
    select to_date('01/06/2010 00:00:00', 'dd/mm/yyyy hh24:mi:ss') into startDate from dual;
    select to_date('01/07/2010 00:00:00', 'dd/mm/yyyy hh24:mi:ss') into endDate from dual;
    str := '%something%aaaaa%';
    open eftcursor(startDate ,endDate , str);
    Do i need to do any kind of conversion in the cursor where clause or when i am passing the parameter in open statement.

    Almora wrote:
    Do i need to do any kind of conversion in the cursor where clause or when i am passing the parameter in open statement.No, your code looks correct -- ou're passing a date to the cursor.
    You might consider whether you really need an explicit cursor though. An implicit cursor is easier to code and performs better.

  • Passing date parameters to a custom folder

    Is there any simple way to pass date parmeters to a custom folder?

    I think I recognize a question very similar to this recently.
    And it's the same situation, in that - what do you mean by passing a date?
    I understand it to mean that you want a user - at run time - to enter a date or date range that will then return only that data from a custom folder.
    1. You could have all data returned (ie: no date conditions applied to the SQL) and then filter using the Disco tool (ie: plus, viewer, desktop).
    2. If you want to 'pass' those date parameters into the actual folder in the EUL, then there is a method that you can use using functions you write.
    3. Or you could code the actual database SQL view with some kind of hard-coded date parameters (ie: SYSDATE - 30), etc.
    Russ

  • Error while passing date parameters in procedure and commit issue

    Hi
    1) I am doing a archiveing records and pls find my code below and i have couple of issue,pls find my code and want to ensure the commit is happening every 100000 rows inserted but i am archeiving a huge table but when i checks the table frequently it shows 0 records and after it shows count the actual rows around 20 million records.How can i ensure it commiting on every 100000 records. pls find my code my db version is 10g on windows
    CREATE OR REPLACE PROCEDURE doins as
    cnt number:=0;
    FOR x IN (select * from Call_log
    where trunc(c_date) = to_date('11-Aug-2008','DD-MON-YYYY'))
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where trunc(c_date) = to_date('11-Aug-2008','DD-MON-YYYY');
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    2) Error while passing date as parameter i am getting following errors while passing date parameter pls find my code and errors
    CREATE OR REPLACE PROCEDURE doins(p_date date) as
    cnt number:=0;
    begin
    FOR x IN (select * from Call_log
    where trunc(c_date) = to_char(p_date,'DD-MON-YYYY'))
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where trunc(c_date) = to_char(p_date,'DD-MON-YYYY');
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    end;
    exec doins(11-Aug-2008) then gives
    SQL> exec doins(11-Aug-2008);
    BEGIN doins(11-Aug-2008); END;
    ERROR at line 1:
    ORA-06550: line 1, column 16:
    PLS-00201: identifier 'AUG' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    if i gave exec doins(11-08-2008) it gaves
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'DOINS'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    rgds
    rosh

    CREATE OR REPLACE PROCEDURE doins(p_date varchar2) as
    cnt number:=0;
    begin
    FOR x IN (select A.rowid,A.* from Call_log A
    where trunc(c_date) = to_date(p_date,'DD-MON-YYYY'))
    --hope that's c_date columne is   DATE datatype
    LOOP
    INSERT INTO call_arch
    select * from Call_log
    where rowid=x.rowid;
    cnt := cnt + 1;
    IF( cnt = 10000 )
    THEN
    cnt := 0;
    commit;
    END IF;
    commit;
    END LOOP;
    end;
    thats your correct procedure - but NOT CORRECT ISSUE.
    You should use bulk collect with limit clause and forall clause to do it faster!!! Or Merge clause.

  • Passing Data from Adobe to WD Java Offline Scenario

    Hi All,
    I have a web dynpro for java component that has 2 views
    View 1. Upload View
    View 2. Interactive Adobe View
    I have an offline adobe form with two parameter First and Last Names. When I fill the form and then upload it (using view 1).When I click on a button display form it branches to View 2 above and displays the form with the filled in values. Now in the second view I have a Submit to SAP Button embedded within the Adobe  form. When I click on the button Submit it should display by passing the values back to the web dynpro component. Here I see that the values passed back are null.
    I am also invoking ContainerFoundation_JS.SendMessageToContainer(event.target, "submit", "",  "", "", ""); within the javascript of the Submit To SAP button. But, still it doesnt seem to pass the values back to WD Java.
    Kindly help me resolve this issue? I sincerely appreciate any help extended.
    Many thanks,
    Best regards,
    Divya

    I had to have scripting done on the form to invoke this back to webdynpro for java.

  • Passing DATE parameters to Oracle Stored Procedures using ADO

    Does anyone know how can I pass a date parameter to an Oracle
    Stored Procedure? The IN parameter of the procedure is of type
    DATE and the ADO parameter is of type DBDate (I've tried Date
    and DBTimeStamp,too). The execution freezes at "Cmd.Execute".
    Can anyone suggest a solution?
    Thanx for any tips

    As far as I know the documentation on CR & stored procedures says that the REF CURSOR has to be a strongly bound one.
    Could you go into a little more detail? Do you mean I should put a multi-valued parameter into a REF CURSOR? Can you post some code snippets here?

  • Parameter Form to Pass Dates to Report

    Hi,If anyone have a sample Form that passing
    date parameters to a report so that a report can select only the Date ranges passed from the Parameter Form. I need to set up a trigger at the Form Control block. Thanks.

    For your 1st problem it seems to be a bug in Forms 6i - you can visit this site:
    http://pipetalk.revealnet.com/~plsql/
    and find there 41211.
    Helena

  • How scheduler job in HPUX and Data Parameters

    Hi guys, is there a way to invoke a PAS procedure from an external scheduler?
    Anyone have an procedure example that passes date parameters for the load data procedure?
    Thank you,
    Rgrds, Vitoriano

    Hi Luis,
    On how to call PAS procedures you might want to check the following thread: Re: Run procedure in Application Server from the command line
    Regarding the date parameters, what are you trying to achive? You can anyway get very good ideas from the wfmde_setup.pro file, used for E&A. There you have some code to turn the actual system date into a PAS parameter.
    Best regards,
    Ricardo Vieira

  • Pass in date from shell script to java program

    Hi,
    I need to pass in some parameter to my java program.
    eg 'java SomeProgram yyyy mm dd hh mm ss'
    How do i use the shell script to generate the valeus for the year, mth day etc?
    The program is running once everyday.
    I tried $argu0 = `date+%y`
    java SomeProgram $argu0
    but not working... thanks for your help!

    Then, why would you want to use 'date' to provide
    'now' to a Java program when you could just use new
    java.util.Date() which probably makes the same call
    as the Unix 'date' command?That works until you need to use a date other than 'now.'
        public static final String ISO_DATE = "yyyy-MM-dd HH:mm:ss";
        public static void main(String[] args) {
            SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat
                    .getDateTimeInstance();
            sdf.applyPattern(ISO_DATE);
            try {
                Date d = sdf.parse(args[0]);
                // rest of code here
            } catch (ParseException e) {
                // handle exception
        }Users will have to enclose there input with quotes otherwise the JVM will consider their input as two parameters, or you can change the pattern to include a character between dd and HH.

  • Passing in parameters to Data Instance

    Hi
    I read in OSM 7.2 Release Notes on vf:instance :
    You can now add explicit parameter values from within an XQuery or XPath that
    augment or override the parameters defined in the OSM data dictionary using
    vf:instance()
    My question is, how do I make use of the parameters passed in in my Data Instance?
    The example given in Developer's Guide says:
    log:info($log,local-name(
    vf:instance($order/oms:GetOrder.Response/oms:_root/oms:data[1],'DataInstance',<oms:url>file://us/catalog.xml</oms:url>)/*[1]
    How do I make use of parameter oms:url in the Data Instance?
    I tried using ${oms:url} but it gives me compile error.
    I created a new namespace for the data instance to obtain the passed in parameters. Is this the correct way?
    the xquery to invoke the data instance:
    let $dataInstanceParams := <m1:params xmlns:m1="http://xxx.com/bcc/osm/com/orderopco/xml">
    <m1:OMGroupRefID>{fn:normalize-space(im:MainOrderLineItem[0]/im:OMGroupRefID/text())}</m1:OMGroupRefID>
    <m1:ActionCode>{fn:normalize-space(im:MainOrderLineItem[0]/im:ActionCode/text())}</m1:ActionCode>
    </m1:params>
    let $dboutput2 := vf:instance('CheckProductGroupExists',$dataInstanceParams/*)
    adapter is JDBC adapter, built-in.
    My Data Instance Behavior's oms:sql is:
    <query xmlns:im="http://xxx.com/bcc/osm/com/orderopco">
    <sql>
    select opg_ref_id from C_OM_OPG_MAP
    where om_product_group='{$OMGroupRefID}'
    and action_code='{$ActionCode}'
    </sql>
    </query>
    Thanks.
    Will
    Edited by: will.s on Dec 10, 2012 6:01 PM added xquery to invoke the data instance

    Hi Will;
    The DatabaseAdapter expects input parameters to be named "in:1", "in:2", "in:3" and so-on. The numbers 1, 2, 3, etc. correspond to the position of the ? entry in your SQL parameter. in:1 would be used as the value for the first ? in your sql, in:2 would be used as the value for the second ? and so-on.
    So based on this, your xquery would need to be something like this:
    let $dataInstanceParams := <m1:params xmlns:m1="http://xxx.com/bcc/osm/com/orderopco/xml">
    <in:1>{fn:normalize-space(im:MainOrderLineItem[0]/im:OMGroupRefID/text())}</in:1>
    <in:2>{fn:normalize-space(im:MainOrderLineItem[0]/im:ActionCode/text())}</in:2>
    </m1:params>
    let $dboutput2 := vf:instance('CheckProductGroupExists',$dataInstanceParams/*)
    We don't care what the namespace is that you use, but the namespace prefix must be "in:".
    For your reference, I'm copying below the full text of the Javadocs for the DatabaseAdapter. You can find the docs for this and other adapters in the OSM SDK Javadocs.
    This class implements a View Framework external instance adapter that executes a SQL statement and builds an XML document based on the result set.
    There are two mandatory parameters for this class, oms:sql and oms:dataSource.
    oms:dataSource: Refers to the jndi name of a JDBC datasource defined in WebLogic. For example 'mslv/oms/oms1/internal/jdbc/DataSource'
    oms:sql: Contains the sql that will be sent to the database. For example 'select * from scott.emp where empno=?'
    Additional optional input parameters may be supplied that will be bound to parameters defined in the oms:sql value. For example, in the above sql statement a parameter is used to define the value for 'empno' in the where clause. A value for this parameter may be specified by defining a paremter called "in:1". If there were additional input parameters defined in the sql statement, these could be passed as "in:2", "in:3" and so on.
    In all cases these input parameters will be assumed to be string values and bound to the sql statement as string values.
    The following is an example of using the DatabaseAdapter to invoke a query:
    <instance name="well_paid_salesman" xsi:type="externalInstanceType">
    <adapter>com.mslv.oms.view.rule.adapter.DatabaseAdapter</adapter> <parameter
    name="oms:dataSource">'mslv/oms/oms1/internal/jdbc/DataSource'</parameter> <parameter
    name="oms:sql">"select * from scott.emp where job='SALESMAN' and sal > ?"</parameter> <parameter
    name="in:1">1250</parameter> </instance>
    The above declaration returns the following XML instance:
    <results> <rowSet> <row> <empno>7499</empno> <ename>ALLEN</ename> <job>SALESMAN</job> <mgr>7698</mgr>
    <hiredate>1981-02-20 00:00:00.0</hiredate> <sal>1600</sal> <comm>300</comm> <deptno>30</deptno> </row> <row>
    <empno>7844</empno> <ename>TURNER</ename> <job>SALESMAN</job> <mgr>7698</mgr> <hiredate>1981-09-08
    00:00:00.0</hiredate> <sal>1500</sal> <comm>0</comm> <deptno>30</deptno> </row> </rowSet> </results>
    The DatabaseAdapter can also be used to execute SQL stored procedures.
    The DatabaseAdapter provides a stored procedure SQL escape syntax that allows stored procedures to be called in a standard way for all RDBMSs. This escape syntax is defined as part of the Java JDBC API.
    This escape syntax has one form that includes a result parameter and one that does not. If used, the result parameter must be registered as an OUT parameter. The other parameters can be used for input, output or both. Parameters are referred to sequentially, by number, with the first parameter being 1.
    {?= call [,, ...]}
    {call [,, ...]}
    Values for input parameters to the stored procedure are specified using the in:1, in:2 (etc.) parameters in the same way as they are for regular SQL queries.
    Output parameters are specified using out:1, out:2 (etc.). Keep in mind that the parameter number (1, 2, 3, etc.) are numbered sequentially from 1 ordered from left to right in the specified SQL statement including both input and output parameters.
    The value of the parameter is the parameter SQL type (see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Types.html for a list of types).
    The following example illustrates how to call a database stored procedure that has one output parameter (the result of the stored procedure call), and one input parameter.
    <instance name="lock_count" xsi:type="externalInstanceType">
    <adapter>com.mslv.oms.view.rule.adapter.DatabaseAdapter</adapter> <parameter
    name="oms:dataSource">'mslv/oms/oms1/internal/jdbc/DataSource'</parameter> <parameter
    name="oms:sql">"{? = call om_cartridge_pkg.get_any_cartridge_id('my_cartridge',?)}"</parameter> <parameter
    name="out:1">'INTEGER'</parameter> <parameter name="in:2">'1.1'</parameter> </instance>
    The above declaration returns the following XML instance:
    <results> <outputParameter number="1">1234</outputParameter> </results>

  • What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?

    Hi All,
    I am new to TestStand. Still in the process of learning it.
    What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?
    Thanks in advance,
    LaVIEWan
    Solved!
    Go to Solution.

    Hi,
    Using the Parameters is the correct method to pass data into and out of a sub sequence. You assign your data to be passed into or out of a Sequence when you are in the Edit Sequence Call dialog and in the Sequence Parameter list.
    Regards
    Ray Farmer

  • Passing date range parameters in MDX Query

    Following is my mdx query
    SELECT NON EMPTY
        [Measures].[Cache Attendees Count]
    ON COLUMNS,
    NON EMPTY
        ([Cache Attendees].[Visit Id].[Visit Id].ALLMEMBERS *
        [Cache Attendees].[User Id].[User Id].ALLMEMBERS *
        [Cache Attendees].[Screen Name].[Screen Name].ALLMEMBERS *
        [Cache Attendees].[User Type Id].[User Type Id].ALLMEMBERS *
        [Cache Attendees].[User Type Name].[User Type Name].ALLMEMBERS *
        [Cache Attendees].[Group Date Count].[Group Date Count].ALLMEMBERS *
        [Cache Attendees].[Insert Time Stamp].[Insert Time Stamp].ALLMEMBERS )
        DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM
        SELECT
                STRTOMEMBER(@FromCacheAttendeesInsertTimeStamp) : STRTOMEMBER(@ToCacheAttendeesInsertTimeStamp)
            ) ON COLUMNS FROM (
            SELECT
                STRTOSET(@CacheAttendeesConferenceId) ) ON COLUMNS FROM [Cube_Attendee])
            WHERE ( IIF( STRTOSET(@CacheAttendeesConferenceId).Count = 1, STRTOSET(@CacheAttendeesConferenceId), [Cache Attendees].[Conference Id].currentmember ) )
    CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
    I want to filter my cube with three parameters
    1. @CacheAttendeesConferenceId
    2. @FromCacheAttendeesInsertTimeStamp
    3. @ToCacheAttendeesInsertTimeStamp
    When i pass following parameters
    ConferenceId = 1, StartDate='2010-01-28T00:00:00', EndDate='2010-02-03T00:00:00'
    Then it show records
    But When i pass following parameters
    ConferenceId = 1, StartDate='2010-01-27T00:00:00', EndDate='2010-02-03T00:00:00'
    Then it display message No Data Available
    PLease help me on this issue why not FromDate & ToDate range works properly.

    Step1:- First i create a SSAS datasource. Then i create a cube for my table CacheAttendees.
    It has following columns:-
    [Cache Attendees].[Conference Id]
    [Cache Attendees].[Group Date Count]
    [Cache Attendees].[Insert Time Stamp]
    [Cache Attendees].[Screen Name]
    [Cache Attendees].[User Id]
    [Cache Attendees].[User Type Id]
    [Cache Attendees].[User Type Name]
    [Cache Attendees].[Visit Id]
    Step2:- Then i create a dimension with this cube with all columns.
    Step3:- Then i deploy my SSAS project.
    Step4:- Use SSAS datasource in my SSRS datasource.
    Step5:- Create a report with chart control. Add a parameter ConferenceId. Set default to 1. When i preview my report then it show Cache Attendees].[Conference Id].[1] in header of report instead of that, When i pass the parameter value as 1 then report cannot show & throw an error. I want to pass this parameter at runtime.
    Step6:- Please help me how is it possible to pass parameter at runtime.

  • How to pass parameters to JasperReports from Java Code !!

    Hi all
    I m working on existing project and struck with a little problem. Though i have created report using iReport tool but i dont know how to integrate my reports with java code and pass suitable parameters.
    Note : To answer this knowledge of jasperreports is must.
    Kind regards
    jitendra

    Note : To answer this knowledge of jasperreports is must.Then Note: you are asking in the wrong place. Try a Jasper Reports forum. Not this site.

  • How to pass dates as parameters in GO URL?

    Hi,
    Can we pass date values as parameters in GO URL?
    I have a date column in my source report that I would like to pass as filter parameter to target reports via GO URL. Could you please let me know the correct syntax if this is possible?

    How can i convert the CHAr to date in the target?? I am using the below syntax and it is receiving a value of 20-JUL-2011.
    '<a href="http://sunt2000-10.wfs.com:9704/analytics/saw.dll?GO&path=/shared/WFS%20Financials/WFS%20Business%20Aviation/WFS%20Business%20Aviation%20Retail%20Volume&Action=Navigate&P0=1&P1=eq&P2="WFS%20Day%20Date"."Calendar%20Date"&P3=' || CAST("WFS Day Date"."Calendar Date" AS CHAR)  || ' ">QTY(USG)</a>'
    I need to convert this as a DATE when navigating to a different page to pass as a parameter.

  • Passing 2 date parameters in report

    I have to create a report in such a way that ...i have to pass 2 date parameters to get the report..
    For example..
    I get report parameter pagein reports and then I enter the parameter
    Parameter1: 27-MAY-10
    Parameter2: 30_JUN-10
    and then i click RUN REPORT
    can any1 help me out how to pass this parameter in report... i am stuck at this point
    NOTE: I want to use the parameter form feature in report builder....

    @ Sarah
    what you do is to call a refort from a form. i think it is not what Suhail want.
    @ Suhail
    if i understand, you want to pass the parameters from the parameterform your report to the report.
    i think you must create a parameterform and save it als html like this:
    To create a simple Parameter Form in HTML:
    1. In a text editor or HTML editor, create an HTML page that contains a form. The
    form should contain a list of values, a field, and a button. The code for this form
    can look something like the following:
    <form name="form1" method="post" action="*NAME_form.jsp*">
    <h2>Parameter Form</h2>
    <input id="connect" type="hidden" name="userid" value="*hr/hr@db-connect*">
    <input type="hidden" name="destype" value="*cache*">
    <input type="hidden" name="desformat" value="*html*">
    <br> Date_beginn: <input type="text" name="Date Beginn" value="">
    <br> Date_end: <input type="text" name="Date end" value="">
    <input type="submit" name="Submit" value="Run Report">
    </form>
    you can save this code als .html.
    Now you can open the code in the report builder and save it als .jsp.
    you can yet start with the copilation of the report.
    i hope this code will help you.

Maybe you are looking for