• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Default Date format issue in ojdbc6

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having my current application running on weblogic 8.3 (java 1.4) and jdbc driver ojdbc14
The default date format used in oracle database is DD-MON-YYYY

When i get the date using rs.getString() , I get the date in default format DD-MON-YYYY

However while upgrading to weblogic 10.3 which uses ojdbc6 the default date format for a date column is datetime
Due to this the existing code which uses rs.getString returns date in different format eg. DD/MM/YYYY HH.MM.SS
Even in case of date column comparision in SQL query ,it gives invalid month error

One solution is to use TO_CHAR() oracle function an give the date format DD-MON-YYYY
Is there any workaround to handle this ,without any code or query change ,so that date is returned in default format DD-MON-YYYY

 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Sandeepn

As a workaround, after creating the connection you can execute this statement:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'

To prevent issues; whenever dealing with dates, it might be better to not use String, but Date.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic