|
David, Here is some sample code. Toolbox version : JTOpen Version 3.0 The code to connect to the AS400 : String driver= "com.ibm.as400.access.AS400JDBCDriver"; String database = "jdbc:as400://national400;prompt=false;date format=usa"; try { Object o = Class.forName(driver).newInstance(); DriverManager.registerDriver((Driver)o); Connection conn = DriverManager.getConnection(database, username, password); return conn; } catch (Exception e) { System.err.println(e); return null; } A call to a stored procedure returns a result set (rs). The following lines return "07/31/1006" when the value should be "01/05/2000". rs.getDate(3, Calendar.getInstance()); rs.getTimestamp(3); rs.getDate(3); rs.getString(3); All other values from the ResultSet rs are correct. The following code returns "Date" rs.getMetaData().getColumnTypeName(3); Thanks for your help. Dwight Slessman "Dave Wall" <dawall@us.ibm.com To: java400-l@midrange.com > cc: Sent by: Subject: Re: Data data type problem using JDBC java400-l-admin@mi drange.com 05/16/2002 12:09 PM Please respond to java400-l The Toolbox driver supports Date fields. Can you give me an example? What level of Toolbox are you using? David Wall Toolbox for Java iSeries ODBC Driver for Linux dslessman@nationalele ctrical.com To: java400-l@midrange.com Sent by: cc: java400-l-admin@midra Subject: Data data type problem using JDBC nge.com 05/16/2002 11:41 AM Please respond to java400-l [ Converted text/html to text/plain ] When using the com.ibm.as400.access.AS400JDBCDriver jdbc driver, I am having problems retrieving DB2 date columns from a result set. I have tried getString(index), getDate(index), and getTimestamp(index). All return the same date which is not correct. When retrieving Timestamp columns, everything works fine. Are Date type columns supported? Any help will be appreciated. Dwight Slessman _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.