This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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 184.108.40.206.0 - 64bit Production
- PL/SQL Release 220.127.116.11.0 - Production
- "CORE 18.104.22.168.0 Production"
- TNS for IBM/AIX RISC System/6000: Version 22.214.171.124.0 - Production
- NLSRTL Version 126.96.36.199.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
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.