-
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.
-
Re
Dear Vikas,
I'm also facing the same problem ...if u got the result then please let me know as soon as possible.....
-
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.
-
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
-
By Thomas in forum ASP.NET
Replies: 6
Last Post: 11-10-2009, 02:31 PM
-
Replies: 6
Last Post: 09-18-2002, 01:25 PM
-
By Melquisedeque in forum ASP.NET
Replies: 0
Last Post: 02-07-2002, 07:21 AM
-
By Victor in forum ASP.NET
Replies: 0
Last Post: 02-07-2001, 10:05 AM
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks