Closed flash-gordon closed 11 years ago
Could you put the following code after "require 'oci8'" and try again?
OCI8::BindType::Mapping[Time] = OCI8::BindType::LocalTime
OCI8::BindType::Mapping[:date] = OCI8::BindType::LocalTime
OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::LocalTime
OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::LocalTime
or
OCI8::BindType::Mapping[Time] = OCI8::BindType::UTCTime
OCI8::BindType::Mapping[:date] = OCI8::BindType::UTCTime
OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::UTCTime
OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::UTCTime
I'm not sure which is better.
Did you mean "require 'oci8'" ?
@yahonda Thanks for the pointing out. I fixed it.
I tested and it works fine. I'll just set
OCI8::BindType::Mapping[Time] = OCI8::BindType::LocalTime
OCI8::BindType::Mapping[:date] = OCI8::BindType::LocalTime
in my delvelopment environment. I'm sure that in my case it will be safe because server and local machine is in the same time zones.
Thank you.
flash-gordon's solution worked a treat. I just wish I'd found this page yesterday.
Will I have to do this for all my future ruby apps when using ruby-oci > 2.1.5 or is it going to be fixed?
You can do it if you are sure that your apps never use timestamp with time zone datatype. Otherwise, the following setting may cause problems.
OCI8::BindType::Mapping[Time] = OCI8::BindType::LocalTime
OCI8::BindType::LocalTime
binds values as timestamp. Time zone information is not sent to the Oracle server.
Hi,
I have recently released Instant Client 64-bit 11.2.0.3 for Mac OS X on my Mountain Lion (10.8.2). It has futher timezone parameters:
I also have Oracle Database 11.2.0.2:
As you can see server and my local library have different versions of timezone files. So I get "ORA-01805 possible error in date/time operation" raised from ocidatetime.c:119 in version 2.1.4. But Oracle documentation tells that I can work when client and server have different tz files: http://docs.oracle.com/cd/E14072_01/appdev.112/e10646/oci10new.htm#LNOCI16761. I tried to comment line with check and it seems to be working now.
Is it right that the check could be modified for work in 11gR2 environment? Main problem is that I can't build new Instant Client because there is no Oracle Database for Mac OS X.