The Artima Developer Community
Sponsored Link

Java Answers Forum
Problem with CallableStatement and PreparedStatement - Urgent

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Syed

Posts: 2
Nickname: j2eesdkal
Registered: Aug, 2003

Problem with CallableStatement and PreparedStatement - Urgent Posted: Oct 7, 2003 10:30 AM
Reply to this message Reply
Advertisement
Hi,
I am working with DB2.
I create a connection using the following code (within a try catch block).

public static Connection getConnection()
{
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
String url = "jdbc:as400://MyIPaddress;naming=system;date format=iso;";
String username = "userid";
String password = "password";
Connection con = DriverManager.getConnection(url, username, password);
return con;
}

Where MyIPaddress is machine name.

The problem I am facing now is if I use the date format=iso (in URL), then any date field fetched from DB as a call to SP (using CallableStatement.executeQuery), results in wrong Date (rs.getDate(storedDate)).
Say if the date stored is 2003/10/17 (yyyy/mm/dd) - it is fetched as 0510/09/30.

Now if the query from above SP is executed using a PreparedStatement.executeQuery returns correct result.

The main reason for using the date format=iso (in URL), is some of our queries fail (even when PreparedStatement.executeQuery )to retrieve any record which have a date field in select clause. This is sloved by including date format=iso.

I would like to know if there is way to solve this problem and get correct date when CallableStatement.executeQuery is used.

Topic: PLS NEED HELP ASAP! Previous Topic   Next Topic Topic: ActionErrors in Validate Method

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use