Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Invoking DB2 Stored Procedure using Java PreparedStatement

Posted on 2002-04-10
3
Medium Priority
?
260 Views
Last Modified: 2006-11-17
I am having a problem with Java Client for DB2 stored procedure. I am using PreparedStatement and setting data using setString() function. In some cases when I have large buffer size the data is getting misaligned on the mainframe side due to some binary/invalid chars getting appended before the string.

Following is the Stored Procedure I/O Structure:

Field Name     DATA TYPE     INPUT/OUTPUT     SIZE
_____________________________________________________
HDRCNTL             VARCHAR          INPUT          300
INORDERNO     CHAR          INPUT          9
INGENL          CHAR          INPUT          91
INDATA          VARCHAR          INPUT          29942
COMMAREA     VARCHAR          OUTPUT          400
_____________________________________________________

I am using setString() to set all the input data elements. The data received on mainframe has 2 additional chars in the beginning of INDATA string. I tried using setBytes() also and that doesn't work either. I am looking for solution to avoid the 2 chars getting on mainframe DB2.


Thanks much.
0
Comment
Question by:ArshadAQ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
asharma2 earned 200 total points
ID: 6932768
Hi Arshad,
      Are you running the java program in NT/Unix?If so then problem here might be because of different encoding pattern accross the platform.In mainframe encoding pattern is EBCDIC and in NT/Unix it is ASCII.SO before doing the set string you need to first translate the ASCII to EBCDIC then do setString.If setString doesn't work then instead of prepareStatement use directly variable in Query.
      You can get several translation program available in net..one such is http://www.room42.com/store/computer_center/java_translate.shtml.

Good luck.

Regards
Alok

0
 
LVL 5

Expert Comment

by:vemul
ID: 7898837
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- points to asharma2

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7959842
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question