Hi Tom,
I have Oracle installed on a machine where the local
timezone is GMT+10. Here's my test script ...
create or replace and compile java source named JTime as
public class JTime
{
public static void ShowDate()
{
java.util.Date dt = new java.util.Date () ;
java.util.TimeZone tz = java.util.TimeZone.getDefault () ;
System.out.println ("dt = " + dt) ;
System.out.println ("tz = " + tz) ;
}
}
/
create or replace procedure JTime
is language java
name 'JTime.ShowDate ()' ;
/
set serveroutput on size 1000000
begin
dbms_java.set_output (1000000) ;
JTime ;
dbms_output.put_line ('Sysdate = ' || to_char (sysdate, 'YYYY-Mon-DD HH24:MI:SS')) ;
end ;
/
Here's the output from executing in SQL*Plus ...
SQL*Plus: Release 8.1.7.0.0 - Production on Tue Dec 11 14:20:45
2001
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.0.0 - 64bit Production
With the Partitioning option
JServer Release 8.1.7.0.0 - 64bit Production
SQL> @tst
Java created.
Procedure created.
dt = Mon Dec 10 22:20:54 EST 2001
tz =
java.util.SimpleTimeZone[id=EST,offset=-
18000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000]
Sysdate = 2001-Dec-11 14:20:55
PL/SQL procedure successfully completed.
As you can see, the Aurora JVM is running with a timezone of GMT-5. If I run pretty much the same java code using the OS JVM (v 1.3), I see a timezone id of "Australia/Victoria". I have tried changing my $TZ environment variable to "Australia/Victoria", and I get a correct value within the Oracle JVM, but it completely screws up SYSDATE (appears to show GMT).
I would dearly love an explanation, and information on how to fix it.
Thanks,
Steve
Here's the output from the properties :
SQL> -- listing properties --
java.specification.name=Java Platform API Specification
java.version=1.2.1
oracle.aurora.mts.INIT=oracle.aurora.mts.rdbms.INIT
user.timezone=EST
java.specification.version=1.2
java.vm.vendor=Oracle Corporation
java.vm.specification.version=1.0
user.home=
java.naming.factory.initial=oracle.aurora.namespace.InitialContex...
os.arch=PA_RISC
java.vendor.url=</code>
http://www.oracle.com/java/ <code>
file.encoding.pkg=sun.io
user.region=US
java.home=/opt/app/oracle/product/8.1.7/javavm/
java.class.path=
line.separator=
java.io.tmpdir=/var/tmp/
jdbc.drivers=oracle.jdbc.driver.OracleDriver
os.name=HP-UX
java.vendor=Oracle Corporation
oracle.jserver.version=8.1.7
oracle.server.version=8.1.7
java.library.path=
java.vm.specification.vendor=Sun Microsystems Inc.
oracle.aurora.namespace.INIT=oracle.aurora.namespace.rdbms.INIT
oracle.aurora.rdbms.SID=DevFM
file.encoding=ISO8859_1
oracle.aurora.mts.session.INIT=oracle.aurora.mts.session.rdbms.INIT
java.specification.vendor=Sun Microsystems Inc.
oracle.aurora.vm.environment.name=rdbms
user.name=
user.language=en
java.vm.name=JServer VM
java.vm.specification.name=Java Virtual Machine Specification
java.class.version=46.0
oracle.aurora.rdbms.oracle_home=/opt/app/oracle/product/8.1.7/
sun.boot.library.path=/opt/app/oracle/product/8.1.7/lib64:
sqlj.runtime=sqlj.framework.ide.aurora.rdbms.Oracl...
java.naming.factory.url.pkgs=oracle.aurora.ejb.jndi:com.sun.jndi.u...
java.protocol.handler.pkgs=oracle.aurora.rdbms.url
os.version=B.11.00
java.vm.version=1.2.1
java.compiler=
path.separator=:
file.separator=/
user.dir=
PL/SQL procedure successfully completed.