Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2012
    Posts
    16

    Question Unanswered: SQL0302N - The value of a host variable in the EXECUTE or OPEN statement - Bulk Copy

    HI,

    i am migrating the database from MS Acces to DB2. i am using my own tool to do this...
    I have used API, DB2BulkCopy.WriteToServer(table).
    in my table i have 227587 rows...
    Out of this 9000+ records are not moved to db2.
    All the 9000+ records doesnt have any problem....to confirm this... i removed all the other records and kept these 9000+ records and tried to insert... Now all the records are migrated successfully.

    and when trying to insert those records i received the error code
    "SQL0302N - The value of a host variable in the EXECUTE or OPEN statement statement is out of range for its corresponding use"

    Problem happens when i try bulk copy. what could be be problem.. ? any idea...


    I am using,
    "DB2 v9.7.400.501", and Fix Pack 4

    Product name: "DB2 Express-C"
    License type: "Unwarranted"
    Expiry date: "Permanent"
    Product identifier: "db2expc"
    Version information: "9.7"
    Max number of CPUs: "2"
    Max amount of memory (GB): "2"

    thanks.
    Mani

  2. #2
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Quote Originally Posted by maniv.dk View Post
    Problem happens when i try bulk copy. what could be be problem.. ? any idea...
    No. Bulk copy is ms-sql terminology so I've got no idea what you are trying to do with db2. Can you share an example of your code?
    Somewhere between " too small" and " too large" lies the size that is just right.
    - Scott Hayes

  3. #3
    Join Date
    Jan 2012
    Posts
    16
    public static void copyIntoSales(DB2Connection conn, DataTable source)
    {
    DB2BulkCopy salesCopy = new DB2BulkCopy(conn);
    salesCopy.DestinationTableName = "SALES";

    try
    {
    salesCopy.WriteToServer(source);
    salesCopy.Close();
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.ToString(), "Exception");
    }
    }


    Hi my code looks like above snippet... DB2BulkCopy is the class... in this WriteToServer is the member which i used... in this example "Source" is the data table.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Try the CLI trace (Tracing the CLI driver by using the db2cli.ini file - IBM DB2 9.7 for Linux, UNIX, and Windows).

    Be prepared for a very large trace file if you must run the test for over 200K rows.
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •