wood burning stoves 2.0*
The moose likes JDBC and the fly likes ojdbc14.jar to ojdbc6.jar Date Format Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ojdbc14.jar to ojdbc6.jar Date Format Problem" Watch "ojdbc14.jar to ojdbc6.jar Date Format Problem" New topic
Author

ojdbc14.jar to ojdbc6.jar Date Format Problem

Edwin Ubongen
Greenhorn

Joined: Jul 01, 2011
Posts: 5
Hi,

Using the ojdbc14.jar, when I execute the SQL query SELECT * FROM nls_session_parameters where parameter = 'NLS_DATE_FORMAT' on a java standalone application. It returns DD.MM.YYYY. However, when I tried to upgrade to ojdbc6.jar and execute the same SQL query, it returns DD-MON-RR. I just want to have an idea why is DD.MM.YYYY format was returned when using ojdbc14 while DD-MON-RR when using ojdbc16. Is there a way for the ojdbc6 to return the same format as ojdbc14 (because returning a different format causes a lot of problem in our application...)?

Please refer to the details below:

Oracle Database Version:
- Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
- PL/SQL Release 11.2.0.2.0 - Production
- "CORE 11.2.0.2.0 Production"
- TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
- NLSRTL Version 11.2.0.2.0 - Production

Java Version: 1.6

Using Oracle SQL Developer, these are the following values of parameters:
SELECT * FROM nls_session_parameters;
- NLS_DATE_FORMAT - DD-MON-RR
- NLS_TIMESTAMP_FORMAT - DD-MON-RR HH.MI.SSXFF AM
- NLS_TIMESTAMP_TZ_FORMAT - DD-MON-RR HH.MI.SSXFF AM TZR

SELECT * FROM nls_instance_parameters;
- NLS_DATE_FORMAT - DD.MM.YYYY
- NLS_TIMESTAMP_FORMAT - (null)
- NLS_TIMESTAMP_TZ_FORMAT - (null)

SELECT * FROM nls_database_parameters;
- NLS_DATE_FORMAT - DD.MM.YYYY
- NLS_TIMESTAMP_FORMAT - DD-MON-RR HH.MI.SSXFF AM
- NLS_TIMESTAMP_TZ_FORMAT - DD-MON-RR HH.MI.SSXFF AM TZR

Thanks in advance for your help!


Edwin
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

Why do you care about date formats? You should be passing values as date/time objects, such as java.sql.Timestamp, and reading them as such. Date format shouldn't matter in JDBC. You can use Java SimpleDateFormat to format the data to your own liking after you have read it from the database.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ojdbc14.jar to ojdbc6.jar Date Format Problem
 
Similar Threads
query working in sqldeveloper and not from java jdbc
Dealing with kanji character in oracle 11g with put_line function of utl_file in pl sql script
Exception in seam:Caused by: org.jboss.seam.RequiredException: In attribute requires non-null value
Default Date format issue in ojdbc6
DATE and sysdate