Calling DB2 Stored procedure(with parameters) from powershell

Hi 
I am trying to call a DB2 stored procedure that has parameters from Powershell scrip and I am not able to can some one help me here?
$ServerName = 'XXXX'
$dbalias='XXXXX'
 $conn_string = "Provider=IBMDADB2;DBALIAS=$dbalias;Uid=;Pwd=;"
 $conn = new-Object system.data.Oledb.OleDbconnection
 $conn.ConnectionString = $conn_string
 $conn.open()
 $query="CALL DBID_CONTROL.GET_TABLE_MAINT_CTL(?,?,?,'MSAS','DATABASE_CONNECTIONS_CUBE','CUBE_PARTITION');"
 $cmd = new-Object system.data.Oledb.OleDbcommand($query,$conn)
  $ds=New-Object system.Data.DataSet
 $da=New-Object System.Data.OleDb.OleDbDataAdapter($cmd)
  $da.Fill($ds) [int]$cur_utc_date_key = $ds.Tables[0].Rows[0][0]
 $cur_utc_date          = $ds.Tables[0].Rows[0][1]
 ###list current date key & current date values
 write-output "current date key value is $cur_utc_date_key"
 write-output "current date value is $cur_utc_date"
 write-output " "
Thanks

Hi 
This is the error message i get when i run the script
Exception calling "Fill" with "1" argument(s): " CLI0100E  Wrong number of parameters. SQLSTATE=07001"
At line:45 char:10
+  $da.Fill <<<< ($ds)
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DotNetMethodException

Similar Messages

  • Call Oracle Stored Procedure with Parameters from Windows Batch File

    Hi,
    I have an oracle procedure that requires two parameters to execute, start date and end date as such:
    CREATE OR REPLACE PROCEDURE insert_orders(
    pSTART_DT IN varchar2
    , pEND_DT IN varchar2
    I want to create a windows batch file to execute the procedure but want to be able to specify the parameters (ie start and end dates) in the batch file as opposed to changing the sql file that the batch file uses to execute the procedure but I don't know what the syntax is. I tried the following but it still doesn't work.
    Sql File: call_insert_orders.sql
    execute insert_orders('&1','&2');
    exit
    Batch File:
    sqlplus username/password @call_insert_orders.sql %01-jan-2010% %01-jan-2011%
    When I execute the batch file, my DOS window still prompts me to enter value 1 so I think it recognizes that there is a variable being used but is not able to fill in the actual value I specify. I'm not an experienced DOS/Windows Batch File person so I'm guessing it's my syntax that's screwed up. There is not a lot of documentation on this subject matter hence my post on this forum. Any helps would be appreciated.
    Thanks

    Hello,
    Just try the same DOS command without all the % sign.
    In MS-DOS, the % at the beginning and at the end of a string are for variables. Which means your batch is looking for a variable called 01-jan-2010 and a variable called 01-jan-2011, but those are the values you want to pass, not the name of variables.
    As they are not defined, nothing is passed to the sqlplus script, and that is why you are prompted for values.
    Hope it will help.
    Regards,
    Sylvie

  • T-sql 2008 r2 place results from calling a stored procedure with parameters into a temp table

    I would like to know if the following sql can be used to obtain specific columns from calling a stored procedure with parameters:
    /* Create TempTable */
    CREATE TABLE #tempTable
    (MyDate SMALLDATETIME,
    IntValue INT)
    GO
    /* Run SP and Insert Value in TempTable */
    INSERT INTO #tempTable
    (MyDate,
    IntValue)
    EXEC TestSP @parm1, @parm2
    If the above does not work or there is a better way to accomplish this goal, please let me know how to change the sql?

    declare @result varchar(100), @dSQL nvarchar(MAX)
    set @dSQL = 'exec @res = TestSP '''+@parm1+''','' '''+@parm2+' '' '
    print @dSQL
      EXECUTE sp_executesql @dSQL, N'@res varchar(100) OUTPUT', @res = @result OUTPUT
    select @result
    A complicated way of saying
    EXEC @ret = TestSP @parm1, @parm2
    SELECT @ret
    And not only compliacated, it introduces a window for SQL injection.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Calling Stored Procedure with parameters from a C program

    Hello, I need to call a PL/SQL stored procedure from a C program.
    Something like this sample program provided by Oracle -
    main()
    int i;
    EXEC SQL BEGIN DECLARE SECTION;
    */* Define type for null-terminated strings. */*
    EXEC SQL TYPE asciz IS STRING(20);
    asciz  username[20];
    asciz  password[20];
    int    dept_no;    / which department to query */*
    char   emp_name[10][21];
    char   job[10][21];
    EXEC SQL VAR emp_name is STRING (21);
    EXEC SQL VAR job is STRING (21);
    float  salary[10];
    int    done_flag;
    int    array_size;
    int    num_ret;    / number of rows returned */*
    int    SQLCODE;
    EXEC SQL END DECLARE SECTION;
    */* Connect to Oracle. */*
    strcpy(username, "SCOTT");
    strcpy(password, "TIGER");
    EXEC SQL WHENEVER SQLERROR DO sqlerror();
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("Enter department number: ");
    scanf("%d", &dept_no);
    fflush(stdin);
    */* Set the array size. */*
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    */* Array fetch loop - ends when NOT FOUND becomes true. */*
    EXEC SQL EXECUTE
    BEGIN personnel.get_employees
    *(:dept_no, :array_size, :num_ret, :done_flag,*
    *:emp_name, :job, :salary);*
    END;
    END-EXEC;
    The question is - how is the Stored procedure get_employees declared ? Or more specifically, how is the salary parameter declared in get_employees ? Any help is highly appreciated.

    Hope following will help
    NOTE: Not tested
    Calling a stored procedure
    This program connects to ORACLE using the SCOTT/TIGER
    account. The program declares several host arrays, then
    calls a PL/SQL stored procedure (GET_EMPLOYEES in the
    CALLDEMO package) that fills the table OUT parameters. The
    PL/SQL procedure returns up to ASIZE values.
    It keeps calling GET_EMPLOYEES, getting ASIZE arrays
    each time, and printing the values, until all rows have been
    retrieved. GET_EMPLOYEES sets the done_flag to indicate "no
    more data."
    #include <stdio.h>
    #include <string.h>
    EXEC SQL INCLUDE sqlca.h;
    typedef char asciz[20];
    typedef char vc2_arr[11];
    EXEC SQL BEGIN DECLARE SECTION;
    /* User-defined type for null-terminated strings */
    EXEC SQL TYPE asciz IS STRING(20) REFERENCE;
    /* User-defined type for a VARCHAR array element. */
    EXEC SQL TYPE vc2_arr IS VARCHAR2(11) REFERENCE;
    asciz username;
    asciz password;
    int dept_no; /* which department to query? */
    vc2_arr emp_name[10]; /* array of returned names */
    vc2_arr job[10];
    float salary[10];
    int done_flag;
    int array_size;
    int num_ret; /* number of rows returned */
    EXEC SQL END DECLARE SECTION;
    long SQLCODE;
    void print_rows(); /* produces program output */
    void sql_error(); /* handles unrecoverable errors */
    main()
    int i;
    char temp_buf[32];
    /* Connect to ORACLE. */
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    strcpy(username, "scott");
    strcpy(password, "tiger");
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("\nConnected to ORACLE as user: %s\n\n", username);
    printf("Enter department number: ");
    gets(temp_buf);
    dept_no = atoi(temp_buf);/* Print column headers. */
    printf("\n\n");
    printf("%-10.10s%-10.10s%s\n", "Employee", "Job", "Salary");
    printf("%-10.10s%-10.10s%s\n", "--------", "---", "------");
    /* Set the array size. */
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    /* Array fetch loop.
    * The loop continues until the OUT parameter done_flag is set.
    * Pass in the department number, and the array size--
    * get names, jobs, and salaries back.
    for (;;)
    EXEC SQL EXECUTE
    BEGIN calldemo.get_employees
    (:dept_no, :array_size, :num_ret, :done_flag,
    :emp_name, :job, :salary);
    END;
    END-EXEC;
    print_rows(num_ret);
    if (done_flag)
    break;
    /* Disconnect from the database. */
    EXEC SQL COMMIT WORK RELEASE;
    exit(0);
    void
    print_rows(n)
    int n;
    int i;
    if (n == 0)
    printf("No rows retrieved.\n");
    return;
    for (i = 0; i < n; i++)
    printf("%10.10s%10.10s%6.2f\n",
    emp_name, job[i], salary[i]);
    /* Handle errors. Exit on any error. */
    void
    sql_error()
    char msg[512];
    int buf_len, msg_len;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    buf_len = sizeof(msg);
    sqlglm(msg, &buf_len, &msg_len);
    printf("\nORACLE error detected:");
    printf("\n%.*s \n", msg_len, msg);
    EXEC SQL ROLLBACK WORK RELEASE;
    exit(1);
    Remember, the datatype of each actual parameter must be convertible to the datatype of its corresponding formal parameter. Also, before a stored procedure is exited, all OUT formal parameters must be assigned values. Otherwise, the values of corresponding actual parameters are indeterminate.
    SQLCHECK=SEMANTICS is required when using an anonymous PL/SQL block.

  • To call db2 stored procedure having parameters in java application

    Hi,
    I've created db2 stored procedure which is running perfectly on db2 server after giving a CALL to it. But when I tried to call this same stored procedure in java application, its reflecting with following error......
    com.ibm.db2.jcc.b.SqlException: [jcc][10100][10910][3.50.152] java.sql.CallableStatement.executeQuery() was called but no result set was returned.
    Use java.sql.CallableStatement.executeUpdate() for non-queries. ERRORCODE=-4476, SQLSTATE=null
    at com.ibm.db2.jcc.b.wc.a(wc.java:55)
    at com.ibm.db2.jcc.b.wc.a(wc.java:102)
    at com.ibm.db2.jcc.b.tk.b(tk.java:575)
    at com.ibm.db2.jcc.b.vk.yb(vk.java:136)
    at com.ibm.db2.jcc.b.vk.executeQuery(vk.java:114)
    at SPApplication.main(SPApplication.java:31)
    Here is the code.......
    import java.sql.*; public class SPApplication { public static Connection con; public static CallableStatement proc_stmt; public static ResultSet rs; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { Class.forName("DB2 DRIVER CLASS"); System.out.println("Class loaded....."); con = DriverManager.getConnection("jdbc:db2://localhost:PORTNO/" +                                   " DatabaseName", "username", "password"); System.out.println("Connection established....."); proc_stmt = con.prepareCall("call procedure_name(?)"); //IN Parameter proc_stmt.setInt(1, 5); System.out.println("Called procedure....."); rs = proc_stmt.executeQuery(); /******** THIS IS LINE NO. 31 *********/ while (rs.next()) {                              // Fetching rows one by one over here } proc_stmt.close(); rs.close(); con.close(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (SQLException sqle) { sqle.printStackTrace(); } finally { /* try { proc_stmt.close(); rs.close(); con.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } */ } } }
    Please correct me, if I am wrong at any point in my application..
    I would really appreciate for resolving my problem.
    Thanks,
    Manasi N.

    Hi jschell ,
    Firstly, I tried out with execute() and getMoreResults() to check if the statement is returning result set. - Its returning "null" only.
    Secondly, I tried with following one by one :
    1. Find a new jdbc driver
    2. Write a different stored procedure.I am using DB2 Express edition - DB2 v9.7.0.0
    I have the required jar files - i)db2jcc.jar ii) db2jcc_license_cu.jar
    From these I found the available jdbc drivers as -
    i) com.ibm.db2.jcc.DB2Driver
    ii) COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver
    iii) com.ibm.db2.jcc.uw.DB2StoredProcDriver
    I tried out my code by using each of these drivers, but still returning result set as null.
    Moreover, I changed my stored procedure which has cursor returning result set. In this case also, result set is null.
    Code snippet for this SP is -
    30             Class.forName("com.ibm.db2.jcc.uw.DB2StoredProcDriver");
    31             System.out.println("Class loaded....");
    32             con = DriverManager.getConnection
    33                 ("jdbc:db2://localhost:portno/dbName", "user", "password");
    34             System.out.println("Connection established....");
    35
    36             proc_stmt = con.prepareCall("call javaSP()");
    37            
    38             System.out.println("Called stored procedure....");
    39            
    40             proc_stmt.execute();
    41             //proc_stmt.executeUpdate();
    42             //rs = proc_stmt.getResultSet();
    43
    44             System.out.println("Query executed....");
    45            
    46             if ((proc_stmt.getMoreResults() == false) &&
    47                     (proc_stmt.getUpdateCount() == -1)) {
    48                 System.out.println("No more result sets");
    49             }o/p is (for every mentioned above jdbc driver) :-
    Class loaded....
    Connection established....
    Called stored procedure....
    Query executed....
    No more result sets..
    The o/p is always "No more result sets"
    What else can be tried out to retrieve the result set from stored procedure from Java application? And the most important, these same stored procedures are returning result sets on db2 server after calling them.
    Thank you,
    Manasi.N
    Edited by: Manasi.N on Apr 14, 2010 12:27 AM
    Edited by: Manasi.N on Apr 14, 2010 12:28 AM

  • Problem Calling MaxDB stored procedure with output from MII Query template

    Hi,
    I am using Max DB Database studio to write stored procedure, I am calling stored procedure from MII Query using CALL statement.
    Can anyone guide me how to pass output values of stored procedure.
    Examlpe::
    call ProcName('[Param.1]','[Param.2]','[Param.3]','[Param.4]','[Param.5]', :isSuccess, :Trace)
    In the above line of code I am not able to get the output values of stored procedure that is isSuccess and Trace values in Query template when executed. But same thing I get when executed in Database studio.
    How do I call with outputs for any stored procedure in MII.
    Any help would be appriciated.
    Thanks,
    Padma

    My call statement is like this
    call RESULTDATA_INSERT('[Param.1]','[Param.2]','[Param.3]', :isSuccess, :Trace)
    I am able to insert record in DB, But I am not getting output values in Query template.I have done this in Fixed Query, when I execute it throws me "Fatal error as Loaded content empty".
    I tried giving select below call but it dont work.
    Regards,
    Rao

  • Calling Stored procedure with Parameters in PowerPivot DataModel

    Hi All,
    I wanted to call a SQL stored procedure from PowerPivot(Excel) on based on changing slicer's value. 
    Currently, we can call stored procedure wihtout any parameter from Data Model tab using 
    Exec stored_proc_name in Table Properties window.
    What if I want to call the same procedure with a parameter whouse value will come by changing slicer's value. I  meant, changing slicer value will act as a parameter to that stored procedure & it should return updated results. 
    Is this possible in PowerPivot?

    Hi Rameshwar,
    According to your description, you call a SQL Server stored procedure in PowerPivot data model, now the problem is that you need to pass a parameter to the stored procedure, right?
    Based on my research, it seems that we cannot achieve this requirement directly in current version of PowerPivot data model. Here is a similar thread for you reference.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5350228d-bc62-4a3b-a1a6-e847483e2858/powerpivot-for-excel-2013-call-execute-stored-procedure-with-parameters?forum=sqlkjpowerpivotforexcel
    If you have any concern about this behavior, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature
    in the following release after official confirmation.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Calling a Stored Procedure with output parameters from Query Templates

    This is same problem which Shalaka Khandekar logged earlier. This new thread gives the complete description about our problem. Please go through this problem and suggest us a feasible solution.
    We encountered a problem while calling a stored procedure from MII Query Template as follows-
    1. Stored Procedure is defined in a package. Procedure takes the below inputs and outputs.
    a) Input1 - CLOB
    b) Input2 - CLOB
    c) Input3 - CLOB
    d) Output1 - CLOB
    e) Output2 - CLOB
    f) Output3 - Varchar2
    2. There are two ways to get the output back.
    a) Using a Stored Procedure by declaring necessary OUT parameters.
    b) Using a Function which returns a single value.
    3. Consider we are using method 2-a. To call a Stored Procedure with OUT parameters from the Query Template we need to declare variables of
    corresponding types and pass them to the Stored Procedure along with the necessary input parameters.
    4. This method is not a solution to get output because we cannot declare variables of some type(CLOB, Varchar2) in Query Template.
    5. Even though we are successful (step 4) in declaring the OUT variables in Query Template and passed it successfully to the procedure, but our procedure contains outputs which are of type CLOB. It means we are going to get data which is more than VARCHAR2 length which query template cannot return(Limit is 32767
    characters)
    6. So the method 2-a is ruled out.
    7. Now consider method 2-b. Function returns only one value, but we have 3 different OUT values. Assume that we have appended them using a separator. This value is going to be more than 32767 characters which is again a problem with the query template(refer to point 5). So option 2-b is also ruled out.
    Apart from above mentioned methods there is a work around. It is to create a temporary table in the database with above 3 OUT parameters along with a session specific column. We insert the output which we got from the procedure to the temporary table and use it further. As soon the usage of the data is completed we delete the current session specific data. So indirectly we call the table as a Session Table. This solution increases unnecessary load on the database.
    Thanks in Advance.
    Rajesh

    Rajesh,
    please check if this following proposal could serve you.
    Define the Query with mode FixedQueryWithOutput. In the package define a ref cursor as IN OUT parameter. To get your 3 values back, open the cursor in your procedure like "Select val1, val2, val3 from dual". Then the values should get into your query.
    Here is an example how this could be defined.
    Package:
    type return_cur IS ref CURSOR;
    Procedure:
    PROCEDURE myProc(myReturnCur IN OUT return_cur) ...
    OPEN myReturnCur FOR SELECT val1, val2, val3  FROM dual;
    Query:
    DECLARE
      MYRETURNCUR myPackage.return_cur;
    BEGIN
      myPackage.myProc(
        MYRETURNCUR => ?
    END;
    Good luck.
    Michael

  • Calling stored procedures with parameters with the Database Connectivi​ty Toolkit

    Hi all,
    I am new to the forum and am having difficulty finding a solution to a particular problem I am having regarding using the LabVIEW Database Connectivity Toolkit on a project I am currently working on at my job.  I have a database in which I have tables and stored procedures with parameters.  Some of these stored procedures have input, output, and return parameters.
    I have been trying to follow this example but to no avail:  http://digital.ni.com/public.nsf/allkb/07FD1307460​83E0686257300006326C4?OpenDocument
    One such stored procedure I am working on implementing is named "dbo.getAllowablePNs", which executes "SELECT * from DeviceType" (DeviceType is the table).  In this case, it does not require an input parameter, it has an output parameter that generates the table [cluster], and has a return parameter which returns an integer value (execution status code) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int, not null), PN (nvarchar(15), null), and NumMACAddresses (int, null).  I have gone over many examples and have talking to NI support to try to implement this and similar stored procedures in LabVIEW but have not been successful.  I am able to connect to the database with the Open Connection VI without error, but am running into some confusion following this step.  I am then trying to use the Create Parameterized Query VI to call the stored procedure and set the parameters.  I assume I would then use the Set Parameter Value VI for each parameter that is wired into the parameters input on the previous Parameterized Query VI?  I am also having some confusion during and following these steps as well.  I would greatly appreciate any advice or suggestions anyone might have in regards to this situation as I am not a SQL expert.  Also, I would be happy to provide any more information that would be helpful.
    Regards,
    Jon
    Solved!
    Go to Solution.

    Also, I don't know if this would be helpful but here is the actual stored procedure in SQL:
    CREATEPROCEDURE [dbo].[getLastSequenceNumber]
    @p1 nvarchar(10)='WO-00000'
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SETNOCOUNTON;
    -- Insert statements for procedure here
    selectmax(SequenceNumber)from Devices where WorkOrderNumber= @p1
    END
    GO

  • Call stored procedure(with parameters) via odbc

    In my application I like to use the below statement to call a stored procedure with parameter and return a result set.
    {CALL PP.getPerson('daniel')}
    but this will just return errors to my application.
    If I change the statement to:
    {CALL PP.getPerson(?')}
    and bind a parameter and its value, it will work.
    My question is, is it possible to call a stored procedure via ODBC without binding parameters in application? I mean, what will be my SQL equivalent if I don't want to do parameter binding in my application?
    Thanks in advance. I appreciate any help :-)

    hi 
    Please see the e.g bellow
    create proc proc_test(@SchoolNumber int,@SchoolName
    varchar(100),@StudentNumber int, @StudnentName
    varchar(100)output ,
    @StudentAddress varchar(100) output,
    @Studentbirthdate datetime output,
    @StudentPhoneNumber varchar(100) output,
    @GuardianName varchar(100) output)
    as
    begin
    select @StudnentName varchar=StudnentName ,
    @StudentAddress =StudentAddress,
    @Studentbirthdate =Studentbirthdate ,
    @StudentPhoneNumber =StudentPhoneNumber,
    @GuardianName =GuardianName
    from table where schoolno=@SchoolNumber
    and SchoolName=@SchoolName
    and StudentNumber=@StudentNumber
    return
    end
    http://technet.microsoft.com/en-us/library/ms187004(v=sql.105).aspx
    http://www.lynda.com/SQL-Server-tutorials/Using-input-output-parameters/104964/113058-4.html
    Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker

  • Calling db2 stored procedures from wls 8.1 sp2

    Hi,
    We noticed strange behaviour when moving customers applications from wls 6.1 to 8.1 sp2. We have a use case where we call db2 stored procedure two times (same prcedure) to make inserts to a database. The first time when procedure is called, everything goes smoothly but at the second time db2 claims that statement is not prepared and gives us sql error sql0518n.
    We do see this error only if we use wls prepared statement cache and without cache (size=0) everything seems to work. We also did some db2 level tracing and noticed that statement is not prepared when using wls cache and db2 cannot execute statement which is not prepared....
    Why I'm asking this? because this is the first time I had disable wls cache. We have used it and even optimized software performance using prepared statement cache in several projects before this.
    Procedure call is done from web container lavel and no EJBs is used. We have tested the use case using autommit option and also committed firts transaction manually and closed connection.
    We are using DB2 8.2 fp7 as a database and IBM level 2 JDBC driver without XA support. Honor global transactions support is on at a datasource.
    Is this normal behaviour? Db2 problem or maybe WLS problem?
    Regards,
    Mika

    I am getting the same exception about an assertion failed at weblogic.t3.srvr.T3Srvr.checkServerLock. Any ideas?

  • Calling a stored procedure with RAW and SYS_REFCURSOR

    How do you call a stored procedure with the following input and output parameters?
    create or replace PROCEDURE test
    v_col1 IN NUMBER DEFAULT NULL ,
    v_col2 IN VARCHAR2 DEFAULT NULL ,
    v_col3 IN RAW DEFAULT NULL ,
    v_vol4 IN DATE DEFAULT NULL,
    cv_1 IN OUT SYS_REFCURSOR
    OPEN cv_1 FOR
    SELECT
    lv_tmp1 aaaa ,
    lv_tmp2 bbbb,
    lv_tmp3 cccc
    FROM DUAL ;
    END;
    Edited by: 925963 on Apr 6, 2012 10:50 AM

    Did you try just declaring the vars?
    untested
    declare
      myCur SYS_REFCURSOR;
      myRaw RAW(4);
      BEGIN
        test (0, 0, myRaw, sysdate, myCur);
      END;

  • Calling a stored procedure with a CLOB as input parameter

    Hello,
    I was unsuccessfully trying to call a stored procedure with a clob as input parameter from my C++ application using occi.
    Anyone got a working example to look at?
    I already checked the thread Invalid OCI handle when creating a Blob which didn't help.
    The problem seems to be that I don't have a lob locator to write my data (xml file) to. I tried creating a temporary clob using the sys.dbms_lob package which only resulted in a major headache on my part...
    I would appreciate any help.
    Kind regards
    Horst
    my environment:
    Visual Studio 2008, C++ application
    Oracle 11g

    To start using a blob you have to insert it into the database and then get it back. Sounds weird but that is how it is. Here is a very simple program to do this:
    #include<occi.h>
    #include <iostream>
    using namespace oracle::occi;
    using namespace std;
    int main()
      try
        Environment *env = Environment::createEnvironment(Environment::OBJECT);
        Connection *conn = env->createConnection("hr","hr","");
        string stmt1 = "insert into blob_tab values (:1) ";
        string stmt2 = "select col1 from blob_tab";
        Blob blob(conn);
        blob.setEmpty(conn);
        Statement *stmtObj = conn->createStatement(stmt1);
        stmtObj->setBlob(1,blob);
        stmtObj->executeUpdate();
        conn->commit();
        Blob blob1(conn);
        Statement *stmtObj2 = conn->createStatement(stmt2);
        ResultSet *rs = stmtObj2->executeQuery();
        while(rs->next())
         blob1 = rs->getBlob(1);
        string stmt3 = "begin my_proc(:1) ;end;";
        Statement *stmtObj3 =  conn->createStatement(stmt3);
        stmtObj3->setBlob(1,blob1);
        stmtObj3->executeUpdate();
      catch (SQLException e)
        cout << e.getMessage();
      /* The tables and procedure are primitive but ok for demo
        create table blob_tab(col1 blob);
        create or replace procedure my_proc(arg in blob)
        as
        begin
         -- just a putline here. you can do other more meaningful operations with the blob here
          dbms_output.put_line('hello');
       end;
    }Hope this helps.
    Thanks,
    Sumit

  • Reporting off oracle stored procedure with parameters error

    Erorr message: Error in File xxx.rpt: Failed to retrieve data from the database. Details: [Database Vendor Code: 907 ]
    Asp.net 2.0 web application.
    CR XI R2 sp2 in BOE XI R2 sp2 on Solaris 10.
    Database: Oracle 10g on Solaris 10. Oracle stored procedure defined in package.
    Happens with reports reporting off stored procedure with parameters.
    The sp is used in the crystal report.
    The web application passes parameters to crystal report, which then passes the parameters to stored procedure.
    Encountered error if:
    r.PromptOnDemandViewing = false;
    r.UseOriginalDataSource = false;
    r.CustomServerType = CeReportServerType.ceServerTypeOracle;
    Report can retrieves data if:
    r.PromptOnDemandViewing = false;
    r.UseOriginalDataSource = true;
    r.CustomServerType = CeReportServerType.ceServerTypeOracle;
    In addition
    The steps are:
    1)     Create oracle package and stored proc.
    2)     In CR Designer, select the stored proc as datasource.
    3)     The parameters names were "generated" by the CR Designer.
    4)     Rename the parameter names.
    5)     Drag the fields onto report.
    We noticed the following with different setting of database logon info:
    When previewing from BOE, get error when "Use custom database logon information specified here"
    However, no error when "Use original database logon information from the report". 
    Am i missing something?

    Please re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly

  • How to call a AM method with parameters from Managed Bean?

    Hi Everyone,
    I have a situation where I need to call AM method (setDefaultSubInv) from Managed bean, under Value change Listner method. Here is what I am doing, I have added AM method on to the page bindings, then in bean calling this
    Class[] paramTypes = { };
    Object[] params = { } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    This works and able to call this method if there are no parameters. Say I have to pass a parameter to AM method setDefaultSubInv(String a), i tried calling this from the bean but throws an error
    String aVal = "test";
    Class[] paramTypes = {String.class };
    Object[] params = {aVal } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    I am not sure this is the right way to call the method with parameters. Can anyone tell how to call a AM method with parameters from Manage bean
    Thanks,
    San.

    Simply do the following
    1- Make your Method in Client Interface.
    2- Add it to Page Def.
    3- Customize your Script Like the below one to Achieve your goal.
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
    operationBinding.getParamsMap().put("username", "oracle");
    operationBinding.getParamsMap().put("role", "F1211");
    operationBinding.getParamsMap().put("Connection", "JDBC");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    i hope it help you
    thanks

Maybe you are looking for

  • Metodo de avaliação do item

    Bom dia, Um usuário entrou no cadastro do item  e mudou o método de avaliação para "Padrão" e deu entrada de uma qtd. Automaticamente a entrada ficou com o custo zero. Qdo vou fazer a saída ele informa q o item está sem custo, e não executa a saída.

  • Why are these placed images blurry??

    I created an image in Photoshop that has: resolution 72 pix/in, 600 px by 800 px (about the average screen size of ereaders) This is what the image looks like on Photoshop at 100% zoom: http://i.imgur.com/0dNU2lU.png When I Place the jpg image in Ind

  • Re: adding canvas to applet

    Hi I am trying to add a canvas to an applet. I am successful in doing so. There is a JMenuBar added to the applet. when I click on the file menu The contents are being displayed behind the canvas and as a result I am neither able to see the buttons n

  • Don't transfer data to SD card or you will ending losing your data if interruption happen

    Hello guys, Don't fall in this trap and let the phone move data from internal memory to SD card to free up space as it can be interrupted for some unkown reasons and end up losing your data. ( Interruption in my case was screen auto lock i believe )

  • Digital signature for device drivers

    i was unable install drivers. Check below picture. Even though i installed certificate for publisher. give me solution. clevershiva