I believe that oracle.jdbc.V8Compatible has been deprecated in Oracle 11
Is this because for a DATE column Oracle is now doing what it did before 8i e.g. return an instance of java.sql.Timestamp for a DATE column?
Their FAQ covers it:
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#08_00
Oracle JDBC 11.1 fixes this problem. Beginning with this release the driver maps SQL DATE columns to java.sql.Timestamp by default. There is no need to set V8Compatible to get the correct mapping. V8Compatible is strongly deprecated. You should not use it at all. If you do set it to true it won't hurt anything, but you should stop using it.
As mentioned above, the 11.1 drivers by default convert SQL DATE to Timestamp when reading from the database. This always was the right thing to do and the change in 9i was a mistake. The 11.1 drivers have reverted to the correct behavior.
Related
We have recently uplifted a major application that was written under JDK6 using ojdbc6 against an 11g Oracle database. It was uplifted to use JDK8 against the same 11g database, but we were also in the midst of upgrading to 12c. The uplifted code has been running in production against the 11g database, but slower than it was before. Against the 12c database in our QA environment, we're noticing jobs either throwing exceptions or running VERY slow. When I looked at the code, I noticed that the project team assigned to uplift the code failed to upgrade the ojdbc from 6 to at least 8. I have since done that work, but now we are getting errors from submitting the following code:
Calendar endModDate = Calendar.getInstance();
// get the timestamp from the db
Query qry = em.createNativeQuery("select SYSTIMESTAMP from dual");
TIMESTAMPTZWrapper tsTZWrapper = (TIMESTAMPTZWrapper)qry.getSingleResult();
The em is our entity manager. But when the code calls the qry.getSingleResult() member function, we get this error:
oracle.sql.TIMESTAMPTZ cannot be cast to org.eclipse.persistence.internal.platform.database.oracle.TIMESTAMPTZWrapper
I've searched high and low for an answer, and anything that resembles an answer doesn't appear to fix my solution. This same logic is used in one other area of the code and produces the same issue. If we switch back to ojdbc6, it then works but we can't use ojdbc6 (and we really shouldn't since we're on jdk8) since we need to upgrade to Oracle 12c in the coming month.
Thanks for any assistance in this matter.
Just quick comment about TIMESTAMP datatype:
There is a bug in JDBC drivers "Bug 21891493 : JDBC SENDS TIMESTAMP SCALE OF NULL WHEN NANOSECONDS ARE ZERO", which can cause creation of excessive number child cursors in Oracle database. This bug was fixed in 12.2 JDBC drivers.
The datatype TIMESTAMP WITH TIMEZONE uses internally a function to convert the this into GMT. When you create an index on it, in some cases this function based index is not used, especially when you compare this column with TIMESTAMP value of different subtype. You should compare exec plans between 11g and 12c.
I have a problem about the visualization of all the attribute type "date" only in ORACLE DB. As in the image, the same date value, if I use a formatter the result is true, instead if show the column with standard output I see a false result.
Yes, the problem was the old version of jdbc driver. We have a old oracle db (9) and for this we're using ojdbc14. But now we tried with ojdbc6.jar version 11.1.0.7.0 and it's run. Thanks
I'm facing an issue with an update statement that worked earlier in Oracle 9i but now it does not update any rows in Oracle 11G. Here is the statement that i'm using.
update account
set
days_to_validate = validated_date - val_requested_Date
where
validated_date >= val_requested_date
The validated_date and val_requested_date are both date fields in the format: dd-mmm-yyyy (18-Mar-2015). This was working earlier in Oracle 9i before we did an upgrade.
Pls advice on how we can fix this.
Thanks
Prashanth
I was able to fix this. I tried including the "to_date" function and it worked in Oracle 11G. Here is the change i made to the query.
update account
set days_to_validate = to_date(validated_date) - to_date(val_requested_Date)
where to_Date(validated_date) >= to_date(val_requested_date)
I'm new to java db, before this I've always used Microsoft SQL for database programming.
I used SQL Express and Management Studio for database testing and creation.
Now i want to use java db instead, i'm confused about some things about Derby:
What platform i should use to test my database queries as i used Management Studio for SQL.
Secondly, i'm confused about formatting Dates in Derby as i used Set DateFormat function in SQL to format dates. I'm using TimeStamp Datatype and i want my date to be stored in the following format in the database: "Wednesday, August 2014, 11:30 PM"
Please Help!
Derby has an interactive sql client called ij, that can be used to test queries. Look for it in the documentation.
Timestamps are not stored in a particular format. You decide the format when you retrieve the value from the database. E.g.:
CREATE TABLE TIMES(THE_TIME TIMESTAMP);
...
java.sql.Timestamp x = rs.getTimestamp(...);
java.sql.Timestamp is a subclass of java.util.Date and you are free to format the value as you want.
To store a value you just create a java.sql.Timestamp from your input in whatever format it is.
Why was the LONG RAW ORACLE column type deprecated in ORACLE 8 ?
Did Oracle have issues with its implementation ?
Lots of reasons mentioned here:
http://forums.esri.com/Thread.asp?c=2&f=59&t=107157
Reasons include performance and lack of functionality with LONG RAW.