Problem accessing DB2 from Universal Driver


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Problem accessing DB2 from Universal Driver

  1. #1
    Join Date
    Feb 2006
    Posts
    7

    Exclamation Problem accessing DB2 from Universal Driver

    Hi,
    In our application we use DB2 v 7 for z/os. We are using CLI based driver for accessing our data by using DB2 COBOL SPs.

    We are migrating from CLI based version to Universal JDBC Driver and using Websphere App Server 6.0.

    We are getting the errors like following while we fire SPs that have date, int or decimal or NULL parameters...

    com.ibm.db2.jcc.a.SqlException: THE VALUE OF INPUT HOST VARIABLE OR PARAMETER NUMBER 010 CANNOT BE USED AS SPECIFIED BECAUSE OF ITS DATA TYPE

    The code looks something like this...
    if (startDate != null)
    callableStatement.setDate(++i, new java.sql.Date(startDate.getTime()));
    else
    callableStatement.setDate(++i, null); //START-DA

    if (standardAgmNo == null)
    callableStatement.setNull(++i, Types.INTEGER); //AGM-NO
    else
    callableStatement.setInt(++i, standardAgmNo.intValue());


    The same code has been working fine when we use CLI Driver and in production since last 3 years.

    This is the version info for driver...
    JDBC driver name : IBM DB2 JDBC Universal Driver Architecture
    JDBC driver version : 2.7.58
    JDBC driver type : 4

    Can you kindly help us resolving this problem?

    Thanks in advance.

  2. #2
    Join Date
    Feb 2006
    Posts
    1

    Re

    Dear Vikas,

    I'm also facing the same problem ...if u got the result then please let me know as soon as possible.....

  3. #3
    Join Date
    Jun 2004
    Posts
    199
    I think I have run into this. It might be because the db fields is a Date and Java doesn't have a date like DB2. It really is like a Timestamp. Try zeroing out the time attributes. Oh, and you should be using Calendar.

  4. #4
    Join Date
    Feb 2006
    Posts
    7

    Thumbs up Solution

    Hi all,

    i found the solution by changing my code
    from
    callableStatement.setDate(++i, new java.sql.Date(startDate.getTime()));
    to
    callableStatement.setString(++i, new java.sql.Date(startDate.getTime()).toString);

    and DB2 works well with this

    With Regards

Similar Threads

  1. Problem accessing SQL server from ASP
    By Thomas in forum ASP.NET
    Replies: 6
    Last Post: 11-10-2009, 02:31 PM
  2. Replies: 6
    Last Post: 09-18-2002, 01:25 PM
  3. Problem accessing the Active Directory
    By Melquisedeque in forum ASP.NET
    Replies: 0
    Last Post: 02-07-2002, 07:21 AM
  4. Replies: 0
    Last Post: 02-07-2001, 10:05 AM
  5. Replies: 1
    Last Post: 02-01-2001, 02:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center