Why do it this way at all?

One way, and a way to make sure your query get exactly what you want:

SELECT TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
Or for insert/update
UPDATE SOMETHING SET SOMEDATE=TO_DATE('2003-12-12 13:01:12','YYYY-MM-DD
HH24:MI:SS');

Just an idea

-----Original Message-----
From: Keates, Mark [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 17, 2003 8:57 AM
To: Jakarta Commons Users List (E-mail)
Subject: [DBCP] Oracle NlsDateFormat

Hi,

When using a servlet engine to connect to different Oracle databases,
which can have differing default date formats, is it the responsibility of
the
servlet to execute an ALTER SESSION if I want to use a specific
date format in my queries? E.g.

        Connection con = ds.getConnection();
        Statement s = con.createStatement();
        s.execute("alter session set NLS_DATE_FORMAT = 'YYYY-MM-DD
HH24:MI:SS'");
        ...
        s.close();
        con.close();

Or can this be passed to the DBCP connection engine somehow so that 
when a new connection is established the correct date format is set? This 
problem has come about since the introduction of
'timeBetweenEvictionRunsMillis'
into the DB ResourceParams section within server.xml.

I'd rather this was done than have to intersperce 'to_date' calls everywhere
;(

Thanks,

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to