× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi Jon,

You've hit upon an oldie, but not so goodie where the toolbox differs from the standard. I have a standard way of going from and to java.sql.Date strings based on the spec, which saves a *lot* of coding that most programmers ignore or are ignorant of, to ensure proper values. Because of the items below, it doesn't work on the AS/400. Don't know why they think they know better than the rest of the world, but it's been that way for a long time.

See:

http://www-03.ibm.com/systems/i/software/toolbox/faqjdbc.html#faqB5

http://www-01.ibm.com/support/docview.wss?uid=nas125a815068ae8792586256aaa0054f5fb


Joe Sam

Joe Sam Shirah - www.conceptgo.com (904) 302-6870
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: www.ibm.com/developerworks/java
Just the JDBC FAQs: www.jguru.com/faq/JDBC
Going International? www.jguru.com/faq/I18N
Que Java400? www.jguru.com/faq/Java400

-----Original Message----- From: Jon Paris
Sent: Tuesday, June 18, 2013 5:37 PM
To: Java Programming on and around the IBM i
Subject: Re: JDBC connection string

That was my first thought Dan - but not so.

If I set the format to ISO in the connection string (and make zero other changes) then the format of the returned result changes to ISO. Similarly if I select *MDY as the format on the connection in Run SQL scripts in Nav then I get the same results as the default for Data Studio.


On 2013-06-18, at 4:27 PM, Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx> wrote:

Jon,

I think it's probably Data Studio trying to format your dates in the display using whatever the locale in your environment. The JDBC specification is very specific (duh!) in the format a date or timestamp field is presented to the java layer. The driver is bound to make the same presentation whether it is JT400 or Oracle or ????. It puts the date into a java.sql.Date object. Then whatever presentation layer Data Studio is using converts the java.sql.Date object into the format it thinks you want to see based on your locale object.

DK

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Tuesday, June 18, 2013 2:24 PM
To: Java400
Subject: JDBC connection string

I'm not sure if this is a doc error or just me but ...

When I use the JT400/JDBC driver in Data Studio, unless I specify the date format on the connection string all displays of dates from a SQL statement are shown in MDY. If I specify ISO I get the results I want. OK but the docs (http://javadoc.midrange.com/jtopen/com/ibm/as400/access/doc-files/JDBCProperties.html#format) say that the date format is only used for date literals - so why does it affect my non-literal results? Is the doc just wrong? The same issue seems to exist on IBM's ODBC driver which has a similar description.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com




--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx 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 IBM i (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.