ORACLE TIMESTAMP DataType support in Toplink ?
Currently we have an application that need to create timestamps with precision up to thousands of a second.
Do you know of any other customer that have similar requirements and how they solve this problem ?
We try changing the SQL DDL to change datatype from DATE to TIMESTAMP(3) which can support a timestamp of 1/1000 seconds precision.
We find that if our Oracle column is defined as Oracle DATE, the last 3 digit will be drop and cause us some duplicate key exception for records that
Get inserted within 1 second because the timestamp is part of the primary key.
ts '2004-03-12 17:13:27.792'
So we change the ORACLE column from DATE to TIMESTAMP(3)
What we find is that Toplink produce this exception
Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
Exception Description: The object [oracle.sql.TIMESTAMP@321b5e39], of class [class oracle.sql.TIMESTAMP], could not be converted to [class java.util.Date].
at oracle.toplink.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:35)
at oracle.toplink.internal.helper.ConversionManager.convertObjectToUtilDate(ConversionManager.java:679)
at oracle.toplink.internal.helper.ConversionManager.convertObject(ConversionManager.java:97)
at oracle.toplink.internal.databaseaccess.DatabasePlatform.convertObject(DatabasePlatform.java:55
Than we try to change our java code and modify the java instance variable type from java.util.Date to java.sql.Timestamp
And we get the following error
Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
Exception Description: The object [oracle.sql.TIMESTAMP@731de027], of class [class oracle.sql.TIMESTAMP], could not be converted to [class java.sql.Timestamp].
at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:650)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1011)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1564)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:335)
We cannot seems to find in toplink mapping workbench how to specify timestamp
========================================================================================================
The TIMESTAMP Datatype
The new TIMESTAMP datatype is almost identical to DATE and differs in only one way:
TIMESTAMPs can represent fractional seconds.
The granularity of a TIMESTAMP value can be as little as a billionth of a second, whereas
DATE variables can only resolve time to the second.
When you declare a TIMESTAMP variable, you can optionally specify the precision that you wish to use for fractional seconds. The default precision is to the millisecond (six decimal digits); the maximum precision is to the billionth of a second (nine decimal digits).
===========================================================================================================
-----Original Message-----
From: Cheung, Ka-Kit
Sent: Friday, March 12, 2004 6:20 PM
To: Burr, Tim; Julian, Robert; Matthiesen, Sean
Cc: Tsounis, George; Del Rosso, Peter; Cham, Mei
Subject: Problem identified : AddressDetail duplicate key problem
If we look at the exact of the insert statement.
We see that the last address detail insert have key of
Address ID = '5a052407-dac6-42ad-bbbf-29edc94488c1', and
TransactionStartDate = {ts '2004-03-12 17:13:27.792'},
While in the database, we look like we have an entry of
Address ID = '5a052407-dac6-42ad-bbbf-29edc94488c1', and
TransactionStartDate = {ts '2004-03-12 17:13:27.229'},
If my memory served me right, while
{ts '2004-03-12 17:13:27.792'}, is different than {ts '2004-03-12 17:13:27.229'},
because are Java timestamps that have precison up to MicroSeconds, therefore 229 is different than 792.
However, when this timestamp is saved to Oracle, I believe (have to check with Mei) that oracle only takes
Up to '2004-03-12 17:13:27 and discard the 229 or 792 because that is the maximum precision of timestamp for oracle.
So we have the second insert have the same '2004-03-12 17:13:27 after stripping off the 792 and we have a same record with the same same '2004-03-12 17:13:27 in the database and
Therefore causing duplicate key exception.
That is why this is happen only once in a while when 2 rapid fire inserts happen in less than 1 second of each other.
The solution actually is in the ESS code itselfs.
The current ESS code will send addDependentToClient multiple times, one for each dependent added
On the screen.
The right way is to add all the dependent on the screen all at once.
To have course grain method like addDependentsToClient, and have a collection or array of dependents as input parameter.
This way we are not causing the participant to create history of themselves multiple times within a very short period of time. It save disk space, conform to a single UOW per submit and that is what I proposed
To solve this problem from the root cause is by enhancing the method to save multiple dependents in one shot rather than a loop of multiple calls.
KK
and
INSERT INTO PTTCBSI.ADDRESS_DETAIL
(LINE_3_AD, ADR_TRAN_UNTIL_DT, MODIFY_DT, CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD, ADR_TRAN_START_DT, CREATE_DT, AUTHOR_ID, ADDRESS_ID, LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID)
VALUES ('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'},
{ts '2004-03-12 17:13:26.385'},
'Oakwood', '61043', 1, '1234', 'Mailstop 820',
{ts '2004-03-12 17:13:26.385'},
{ts '2004-03-12 16:50:12.0'}, 'dataLoad',
'5a052407-dac6-42ad-bbbf-29edc94488c1',
'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
UnitOfWork(1238222885)--Connection(2102560837)--
UPDATE PTTCBSI.ADDRESS_DETAIL
SET ADR_TRAN_UNTIL_DT = {ts '2004-03-12 17:13:26.385'}, VER_ID = 2 WHERE
(((ADDRESS_ID = '5a052407-dac6-42ad-bbbf-29edc94488c1') AND
(ADR_TRAN_START_DT = {ts '2004-03-12 16:52:29.0'})) AND (VER_ID = 1))
UPDATE PTTCBSI.ADDRESS_DETAIL SET
ADR_TRAN_UNTIL_DT = {ts '2004-03-12 17:13:27.229'}, VER_ID = 2
WHERE (((ADDRESS_ID = '5a052407-dac6-42ad-bbbf-29edc94488c1') AND (ADR_TRAN_START_DT = {ts '2004-03-12 17:13:26.0'})) AND (VER_ID = 1))
UnitOfWork(102762535)--Connection(2102560837)--
INSERT INTO PTTCBSI.ADDRESS_DETAIL
(LINE_3_AD, ADR_TRAN_UNTIL_DT, MODIFY_DT, CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD, ADR_TRAN_START_DT, CREATE_DT, AUTHOR_ID, ADDRESS_ID, LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID) VALUES
('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'}, {ts '2004-03-12 17:13:27.229'}, 'Oakwood', '61043', 1, '1234', 'Mailstop 820',
{ts '2004-03-12 17:13:27.229'},
{ts '2004-03-12 16:50:12.0'}, 'dataLoad',
'5a052407-dac6-42ad-bbbf-29edc94488c1',
'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
INSERT INTO PTTCBSI.ADDRESS_DETAIL
(LINE_3_AD,
ADR_TRAN_UNTIL_DT,
MODIFY_DT,
CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD,
ADR_TRAN_START_DT,
CREATE_DT,
AUTHOR_ID,
ADDRESS_ID,
LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID) VALUES
('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'},
{ts '2004-03-12 17:13:27.792'},
'Oakwood', '61043', 1, '1234',
'Mailstop 820',
{ts '2004-03-12 17:13:27.792'},
{ts '2004-03-12 16:50:12.0'},
'dataLoad',
'5a052407-dac6-42ad-bbbf-29edc94488c1',
'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
ClientSession(790235177)--Connection(2102560837)--rollback transaction
ORA-00001: unique constraint (PTTCBSI.PK_ADDRESS_DETAIL) violated
KK,
We are back-porting the support for oracle.sql.TIMESTAMP to 9.0.4 in an upcoming patch-set. It is possible to enhance TopLink using a customer conversion manager or database platform to add this support if required in the short term.
Doug
Similar Messages
-
Oracle licensing and support of Toplink
I know this is not a typical forum entry, but I'm at my wit's end, so I hope someone can help me...
We purchased Toplink from Webgain (UK) and have been using it productively for quite some time. I have a licensing query about Toplink, which I have been trying to get out of Oracle (UK) for almost a month now. I have been shunted between call centres, departments, e-mailees, etc. but still no answer. Someone finally mailed me our license details, but it turned out to be only our Oracle DATABASE licenses, not those for Toplink.
So: does anyone else have experience of dealing with Oracle as regards the Toplink product? In the UK?
Any help will be appreciated.Please contact me and provide your company/contact, donald.smith @oracle.com. I will be able to help.
- Don
I know this is not a typical forum entry, but I'm at my wit's end, so I hope someone can help me...
We purchased Toplink from Webgain (UK) and have been using it productively for quite some time. I have a licensing query about Toplink, which I have been trying to get out of Oracle (UK) for almost a month now. I have been shunted between call centres, departments, e-mailees, etc. but still no answer. Someone finally mailed me our license details, but it turned out to be only our Oracle DATABASE licenses, not those for Toplink.
So: does anyone else have experience of dealing with Oracle as regards the Toplink product? In the UK?
Any help will be appreciated. -
TIMESTAMP datatype in Oracle 8i.
'TIMESTAMP' datatype is not to be available in Oracle 8i.
Is there an equivalent datatype in Oracle 8i as 'TIMESTAMP' in 9i?
Regards,
BhagatTimestamp was a new globalization feature in 9i. The only way to handle time in 8i is with the regular DATE type and traditional date arithmetics.
-
How to obtain a number of seconds between 2 fields in TimeStamp datatypa
Hello, I need to have the result of a difference between 2 fields (date1 - date2)which are in TimeStamp datatype
The result given must be in seconds
I am using owb 10.2.1.0.31
Can so help me ?
Thankscheck the Puget Sound Oracle Users Group page (http://www.psoug.org/) at
http://www.psoug.org/reference/timestamp.html
And more information on the INTERVAL DAY TO SECOND datatype at
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#SQLRF00207
here's an excerpt from the PSOUG page:
CREATE TABLE tint_test (
msg VARCHAR2(25),
start_date TIMESTAMP WITH TIME ZONE,
end_date TIMESTAMP WITH TIME ZONE,
duration_1 INTERVAL DAY(5) TO SECOND,
duration_2 INTERVAL YEAR TO MONTH);
INSERT INTO tint_test
(msg, start_date, end_date)
VALUES
('my plane ride',
timestamp'2004-08-08 17:02:32.212 US/Eastern',
timestamp'2004-08-08 19:10:12.235 US/Pacific');
UPDATE tint_test
SET duration_1 = (end_date - start_date) DAY(5) TO SECOND,
duration_2 = (end_date - start_date) YEAR TO MONTH;
SELECT msg, duration_1, duration_2 FROM tint_test;
SELECT t.*, end_date - start_date FROM tint_test t; -
Timestamp datatype not output correctly in table export
When using the data export from table view timestamp datatype is not handled correctly. It shows as oracle.sql.TIMESTAMP@14c0761.
Works fine from SQL Explorer view though.Im using the same build. 1.0.0.15.27.
You can try any export option. I tried SQL Insert.
If you right click from the data grid (SQL Worksheet or Table view it works fine)
In the table view, if you go to Actions -> Export -> SQL Insert then it doesn't. -
In Oracle 10g global support system,I have set parameter of NLS_DATE_FORMAT.I am wondering about that whether it could affect the default value of NLS_TIMESTAMP_FORMAT?
Message was edited by:
frank.qiantest@ORCL> select sysdate from dual;
SYSDATE
24-NOV-06
Elapsed: 00:00:00.00
test@ORCL> DECLARE
2 checkout TIMESTAMP(3);
3 BEGIN
4 checkout := '22-JUN-2004 07:48:53.275';
5 DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
6 END;
7 /
22-JUN-04 07.48.53.275 AM
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
test@ORCL> alter session set nls_date_format="MM/DD/YYYY";
Session altered.
Elapsed: 00:00:00.00
test@ORCL> select sysdate from dual;
SYSDATE
11/24/2006
Elapsed: 00:00:00.00
test@ORCL> DECLARE
2 checkout TIMESTAMP(3);
3 BEGIN
4 checkout := '22-JUN-2004 07:48:53.275';
5 DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
6 END;
7 /
22-JUN-04 07.48.53.275 AM
PL/SQL procedure successfully completed.
test@ORCL> alter session set NLS_TIMESTAMP_FORMAT = 'DD/MM/YYYY HH:MI:SS.FF';
Session altered.
Elapsed: 00:00:00.00
test@ORCL> DECLARE
2 checkout TIMESTAMP(3);
3 BEGIN
4 checkout := '22-JUN-2004 07:48:53.275';
5 DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
6 END;
7 /
22/06/2004 07:48:53.275
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
test@ORCL>
test@ORCL> -
How to use the Oracle AQ JMS API using Toplink
My application is using AQ using PL/SQL. We want to convert the PL/SQL code to the JMS interface Oracle offers, the problem is that I need to use a java.sql.Connection object in order to connect to the AQ. I don't own the java.sql.Connection in Toplink. How can I enqueue/dequeue to a JMS AQ using Toplink?
In the upcoming 10.1.3 release, TopLink supports mapping to/from Oracle AQ messages through a JCA adapter. This functionality is currently available in the 10.1.3 developer preview release on the Oracle OTN web site. If you have an earlier version of TopLink, using AQ directly may make more sense with TopLink only being used to access an existing JDBC connection.
To use AQ directly a JDBC connection is required - then the AQ JMS interface can be used to access any messages. If TopLink has a JDBC connection with Oracle AQ, it (the JDBC connection) can be accessed via session.getAccessor().getConnection(). Also, if a J2EE datasource/connection pool is being used a JDBC connection could be obtained there as well. One thing to note is that creating a new JDBC connection would be 'safer', as this would avoid having the connection managed when it shouldn't be.
For information on how Oracle TopLink provides EIS access to AQ, please refer to: http://www.oracle.com/technology/products/ias/toplink/preview/howto/eisAq/index.htm -
Oracle Spatial Datatypes and Dataguard 11g
Hi
Does anyone know if the following datatypes are supported in dataguard 11g for logical standby or physical standby?
SDO_Geometry
SDO_georaster
thanks
sunirA correction. Logical standby (SQL Apply) doesn't currently natively support spatial data types but sdo_geometry can be supported thru EDS by creating a logging table and two triggers and some manual work. Please check it out from My Oracle Support:
Note 559353.1 - Extended Datatype Support (EDS) for SQL Apply. "Extended Datatype Support (EDS) is the ability for SQL Apply to extend support for additional datatypes that are not natively supported yet by SQL Apply. EDS relies on a new capability in Oracle Database 10g Release 2 Patch Set 3 (10.2.0.4) and Oracle Database 11g Release 1 Patch Set 1 (11.1.0.7) that allows triggers to fire on the logical standby database. "
Note 565074.1 - EDS for SQL Apply Example - Oracle Spatial Type SDO_GEOMETRY
thanks
Jeffrey -
Timestamp datatype issue in Expression
Hi
I am extracting data from oracle table which timestamp datatype for one column then connected to Expression operator. When i see the data type of timestamp in sourcetable it is timestamp(3), But when i see the data type of timestamp in Expression operator it says timestamp(3) but it is adding 6 in the precision by default and that cannot be changed. I tried creating new column in expression it behaved the same. there by my mapping is giving me the warnings regarding this.
Could you guys please help on this.
ThanksHi Cezar,
Thanks for your quick reply.
I am currently doing the second step you have mentioned. I even went to the extent of cutomizing the I$ tables getting created with a custom structure to avoid this. But this is very tedious as i have hundreds of columns in the table.
Is this a bug in ODI? I am asking this because this is a general functionality and should be ideally covered by such a good ELT tool.
I have raised a SR for the same, let us see what solution they have in store:)
Anyway thanks for your valuable suggestion its really useful.
But I have a doubt regarding the versions. Whats the difference between versions 10.1.3.2.0 which I am using and 10.1.3.4.0? I hope this version is not creating this issue?
Thanks,
Vikram -
Convert SQL SERVER DATETIME into ORACLE TIMESTAMP
I have to convert a column's datatype.
The source column's datatype is DATETIME which is in SQL Server to TIMESTAMP(datatype in target which is oracle)
Can anyone help me pleaseJust issue ALTER TABLE MODIFY:
SQL> create table tbl(c date)
2 /
Table created.
SQL> insert into tbl values(sysdate)
2 /
1 row created.
SQL> select to_char(c,'mm/dd/yyyy hh24:mi:ss') from tbl
2 /
TO_CHAR(C,'MM/DD/YY
12/26/2009 20:50:58
SQL> alter table tbl modify c timestamp
2 /
Table altered.
SQL> select c from tbl
2 /
C
26-DEC-09 08.50.58.000000 PM
SQL> SY. -
JDBC Thin Client and Oracle Long Datatype
I am using Wepshere 4.0.2 , JDBC 2.0 (thin driver) and oracle 9i.
I have a procedure which takes Oracle Long Datatype as its parameter.
I use following code to execute procedure.
String dataforsql="AAA000000003 123123 07/01/200301/01/2003";
byte[] bytes = dataforsql.getBytes();
InputStream is = new ByteArrayInputStream(bytes);
cstmt=conn.prepareCall("call nscw.CPPF_SAVEPDCRAWTABLE2(?,?,?)");
cstmt.setAsciiStream (1, is,bytes.length);
The above code works perfectly for data upto 4000 bytes. Once the data crosses the 4000 mark.
i get a procedure error
ORA-01460: unimplemented or unreasonable conversion requestedcstmt.setAsciiStream (1, is,bytes.length);Oracle's support for CLOB (and BLOB) columns using set{Ascii,Binary}Stream() generally s*cks. You'll have to read Oracle's own JDBC manual (you can read it online at http://technet.oracle.com) for whatever sequence they recommend.
E.g. for insertion and updation of CLOBS, you're supposed to use an oracle-specific function (EMPTY_CLOB()) as the value in the INSERT/UPDATE statement, and then do a SELECT, getClob(), and use Clob APIs to update the actual column value. At least officially. Or you have to use some Oracle-specific APIs in oracle.sql.Connection and oracle.sql.CLOB. -
DB2 timestamp to oracle timestamp conversion
Does any one know how to convert Db2 timestamp into oracle timestamp.
From DB2 we are getting timestamp in this format (2000-03-06-16.02.19.074474) (26 bytes).
I want to insert this into oracle thru owb into oracle table with column type timestamp.
Does anyone know the procedure for this type of conversion
Thanks in advance..Hi,
Try a migration tool at www.ispirer.com/chyfo.html
It provides you the fastest, the easiest and the most powerful way to migrate
DB2 database into Oracle.
It works in conjunction with Oracle SQL Loader. The tool creates text files (moving of LOBs are fully supported), generates
CREATE TABLE scripts for Oracle and control files for SQL Loader.
The tool has a lot of other features.
Best regards, Dmitry.
null -
Timestamp Datatype invalid in Oracle9i
I tried to set a column to timestamp datatype in 9i but it returns invalid datatype
Can anyone tell me why is this happen?
I used the following statement
create table test (modified timestamp);No, TIMESTAMP is not supported in Forms. However, a fix is forthcoming to address problems with the Builder's Wizards improper handling of unsupported datatypes such as this one.
Ref._
Bug 2567564
Bug 8836073 -
How to configure Oracle National Language Support for Hindi
Hello
I am Working on one library project and right now it is in foxpro.
it is working in local(hindi) language using c-dec software.Now i want to run this project using oracle national
language support.i have done lots of rnd on that but till could not get success.what's wrong with that?
Following the step i am applied for that
1 I have create the database using in8iscii character set. Because In8iscii support the Hindi Language.
2 Set the variable NLS_LANG = hindi_india.in8iscii in environment. I am using the Windows 2000 OS because
it supports the Hindi font(Mangal).
3 I am using the Oracle Developer as front end so using mangal font in front end i am able to display data
in Hindi format that's why i am selected Windows 2000 os.
4 I have done the special setting in Windows 2000 for Hindi.it is in controlpanel-regional setting-click the indic option
for india and in input locals set keyboard layout as Hindi also.
5 I also changed the Init.ora file and add the NLS_LANGUAGE = Hindi
nls_territory = india. now, I opens the database using this Init.ora file.
6 But It can't display the data in Hindi format.I could not able to display the data in Front End also.
So,pls help me in Oracle and also guide me in Linux platform also.
nullHi Nimit,
I have tried inserting Hindi/Marathi into an Oracle database (I have tried versions 8.0.6 and 8.1.7).
I created the database using UTF8 character set. The NLS_LANG was set to AMERICAN_AMERICA.UTF8. Inserts into the database were via iSQL*Plus or import. For querying I used OCI and Pro*C. The data for my app is being served up as XML. I have not tried Developer. The DB platforms have been both HPUX and Win2K, while the client platform has been Win2K/IE5.5 SP2. I have been using Code2000 as the font.
Did you manage to view the stored data using the export utility ?
Also, you can try using yudit to edit unicode files on Linux. -
Mapping util.Date to Oracle timestamp
Tuesday, March 22, 2005
I am currently experiencing difficulty in mapping a java.util.Date
field to an Oracle TIMESTAMP column.
Here's what I see. By default, Kodo maps the date field to a DATE
column. I suppose this makes sense since Oracle's date columns
have time information that resolves to the second. In this case,
the client has a business case to store subsecond resolution,
hence the desire to store the date field in an Oracle TIMESTAMP
column.
First question: how should this be done?
Here's what I've tried. I tried setting the jdbc-type extension
for the date field to "timestamp". This setting makes no
difference, and I suspect the reason is that OracleDBDictionary
has made the mapping from TIMESTAMP to DATE.
I tried setting the jdbc-sql-type extension for the date field to
"timestamp". This makes a difference only when I drop the table.
Then the schematool's refresh action creates a table with date's
field mapped to a TIMESTAMP column. I have also gone ahead and
manually altered the table to achieve the same effect.
Once the mapping is created, I see the following behavior. Kodo
has no problem reading the TIMESTAMP column and putting the info
into the date field. It also has no problem saving non-null date
values into the TIMESTAMP column. But it does have a problem
storing a null in the date field.
Second question: what is the workaround to this problem?
The the stack dump (obtained by using the JDO Tools Library
example) follows.
Thanks in advance,
David Ezzio
enter command:
--> return book
Select the book to return:
1. book [com.ysoft.jdo.book.library.Book-354] "Gone to War" checked out:
Tue Mar 22 10:38:01 EST 2005
2. book [com.ysoft.jdo.book.library.Book-356] "Gone to Work" checked
out: Tue Mar 22 10:33:58 EST 2005
3. book [com.ysoft.jdo.book.library.Book-357] "Gone Fishing" checked
out: Tue Mar 22 10:33:58 EST 2005
4. book [com.ysoft.jdo.book.library.Book-360] "Gone Sailing" checked
out: Tue Mar 22 10:33:58 EST 2005
5. book [com.ysoft.jdo.book.library.Book-355] "Gone Hunting" checked
out: Tue Mar 22 10:33:58 EST 2005
Enter selection:
--> 2
okay
enter command:
--> commit
exception caught in command
kodo.util.FatalDataStoreException: The transaction has been rolled back.
See the nested exceptions for details on the errors that occu
rred.
at
kodo.runtime.PersistenceManagerImpl.throwFlushException(PersistenceManagerImpl.java:1262)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1122)
at
kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1005)
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:932)
at
kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:592)
at
com.ysoft.jdo.book.library.LibraryHandler.commitTransaction(LibraryHandler.java:175)
at
com.ysoft.jdo.book.library.client.CommitTransaction.execute(Library.java:279)
at
com.ysoft.jdo.book.common.console.UserInterface.execute(UserInterface.java:196)
at
com.ysoft.jdo.book.common.console.UserInterface.pumpCommands(UserInterface.java:186)
at com.ysoft.jdo.book.library.client.Library.run(Library.java:139)
at com.ysoft.jdo.book.library.client.Library.main(Library.java:104)
NestedThrowablesStackTrace:
kodo.util.DataStoreException: Invalid column type
at
kodo.jdbc.sql.DBDictionary.newDataStoreException(DBDictionary.java:3081)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:77)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:63)
at kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:43)
at
kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:89)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:445)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:193)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:95)
at
kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:609)
at
kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:153)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1122)
at
kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1005)
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:932)
at
kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:592)
at
com.ysoft.jdo.book.library.LibraryHandler.commitTransaction(LibraryHandler.java:175)
at
com.ysoft.jdo.book.library.client.CommitTransaction.execute(Library.java:279)
at
com.ysoft.jdo.book.common.console.UserInterface.execute(UserInterface.java:196)
at
com.ysoft.jdo.book.common.console.UserInterface.pumpCommands(UserInterface.java:186)
at com.ysoft.jdo.book.library.client.Library.run(Library.java:139)
at com.ysoft.jdo.book.library.client.Library.main(Library.java:104)
NestedThrowablesStackTrace:
java.sql.SQLException: Invalid column type
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at
oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6164)
at
oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1316)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.PoolConnection$PoolPreparedStatement.setNull(PoolConnection.java:406)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.setNull(LoggingConnectionDecorato
r.java:792)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at kodo.jdbc.sql.DBDictionary.setNull(DBDictionary.java:950)
at
kodo.jdbc.sql.OracleDictionary.setNull(OracleDictionary.java:450)
at kodo.jdbc.sql.RowImpl.toSQL(RowImpl.java:828)
at kodo.jdbc.sql.RowImpl.flush(RowImpl.java:1039)
at kodo.jdbc.sql.RowImpl.flush(RowImpl.java:975)
at
kodo.jdbc.runtime.PreparedStatementManager.flushInternal(PreparedStatementManager.java:160)
at
kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:84)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:445)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:193)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:95)
at
kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:609)
at
kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:153)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1122)
at
kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1005)
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:932)
at
kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:592)
at
com.ysoft.jdo.book.library.LibraryHandler.commitTransaction(LibraryHandler.java:175)
at
com.ysoft.jdo.book.library.client.CommitTransaction.execute(Library.java:279)
at
com.ysoft.jdo.book.common.console.UserInterface.execute(UserInterface.java:196)
at
com.ysoft.jdo.book.common.console.UserInterface.pumpCommands(UserInterface.java:186)
at com.ysoft.jdo.book.library.client.Library.run(Library.java:139)
at com.ysoft.jdo.book.library.client.Library.main(Library.java:104)
enter command:
-->Hi Stephen,
There are two related issues that are addressed. One, some Oracle
drivers return the wrong type (Type.OTHER) for the TIMESTAMP field.
This is true for the
9.2.0.1.0 driver that ships with 9iR2. This causes an exception when
attempting to assign a null to the date field that has been mapped to a
TIMESTAMP column. Two, all of the 9i drivers (and 10g drivers) return a
type name of "TIMESTAMP(x)" where x is the precision. This confuses
Kodo's OracleDictionary which is looking for a string without the
precision characters.
Following your suggestion, the following code fixes it just fine. It is
harmless, in that all it does is do what OracleDictionary intended but
failed to do. To use it, you must add the following property
configuration to the kodo.properties file.
kodo.jdbc.DBDictionary: xxx.jdo.FixedOracleDictionary
Without the fix, Kodo does not reassign the TIMESTAMP columns to a type
of DATE. So far as I can tell, as long as the driver returns a
Types.TIMESTAMP this does not cause a failure.
This fix will be moot as soon as the bug in OracleDictionary is fixed.
What I wonder about is why does Kodo reassign type TIMESTAMP to DATE?
Why don't you treat TIMESTAMP types as TIMESTAMP types? Curious minds
want to know.
Best wishes,
David
---- code follows
package xxx.jdo;
import java.sql.*;
import kodo.jdbc.schema.*;
import kodo.jdbc.sql.*;
* Some Oracle drivers do not return the correct type for the TIMESTAMP
field.
* This class fixes this issue for Kodo 3.3. The problem (an exception
complaining
* about an invalid column type) appears when mapping a Java field
(Date for example) to
* an Oracle timestamp field, and only when attempting to set null on
the Java field.
public class FixedOracleDictionary
extends OracleDictionary
public Column[] getColumns (DatabaseMetaData meta, String catalog,
String schemaName, String tableName,
String columnName, Connection conn)
throws SQLException
// Let Kodo's OracleDictionary do its thing
Column[] cols = super.getColumns (meta, catalog, schemaName,
tableName,
columnName, conn);
// Catch the columns with a name of "TIMESTAMP(n)" and mark them
as DATE types.
// This is what the OracleDictionary intended to do, but was
foiled by the
// name which now has a precision.
for (int i = 0; cols != null && i < cols.length; i++)
String tName = cols.getTypeName();
if (tName != null && tName.startsWith("TIMESTAMP"))
cols[i].setType(Types.DATE);
return cols;
---- code ends
Stephen Kim wrote:
This is a bug (1111)with regards to specific combinations of Oracle 10
driver and db.
To work around the issue until the next relase, getColumns (...) in
OracleDictionary needs to be extended/modified to instead of doing a
strict equals () comparison to "TIMESTAMP", to instead do a startsWith
("TIMESTAMP")
David Ezzio wrote:
Tuesday, March 22, 2005
I am currently experiencing difficulty in mapping a java.util.Date
field to an Oracle TIMESTAMP column.
Here's what I see. By default, Kodo maps the date field to a DATE
column. I suppose this makes sense since Oracle's date columns
have time information that resolves to the second. In this case,
the client has a business case to store subsecond resolution,
hence the desire to store the date field in an Oracle TIMESTAMP
column.
First question: how should this be done?
Here's what I've tried. I tried setting the jdbc-type extension
for the date field to "timestamp". This setting makes no
difference, and I suspect the reason is that OracleDBDictionary
has made the mapping from TIMESTAMP to DATE.
I tried setting the jdbc-sql-type extension for the date field to
"timestamp". This makes a difference only when I drop the table.
Then the schematool's refresh action creates a table with date's
field mapped to a TIMESTAMP column. I have also gone ahead and
manually altered the table to achieve the same effect.
Once the mapping is created, I see the following behavior. Kodo
has no problem reading the TIMESTAMP column and putting the info
into the date field. It also has no problem saving non-null date
values into the TIMESTAMP column. But it does have a problem
storing a null in the date field.
Second question: what is the workaround to this problem?
The the stack dump (obtained by using the JDO Tools Library
example) follows.
Thanks in advance,
David Ezzio
enter command:
--> return book
Select the book to return:
1. book [com.ysoft.jdo.book.library.Book-354] "Gone to War" checked
out:
Tue Mar 22 10:38:01 EST 2005
2. book [com.ysoft.jdo.book.library.Book-356] "Gone to Work" checked
out: Tue Mar 22 10:33:58 EST 2005
3. book [com.ysoft.jdo.book.library.Book-357] "Gone Fishing" checked
out: Tue Mar 22 10:33:58 EST 2005
4. book [com.ysoft.jdo.book.library.Book-360] "Gone Sailing" checked
out: Tue Mar 22 10:33:58 EST 2005
5. book [com.ysoft.jdo.book.library.Book-355] "Gone Hunting" checked
out: Tue Mar 22 10:33:58 EST 2005
Enter selection:
--> 2
okay
enter command:
--> commit
exception caught in command
kodo.util.FatalDataStoreException: The transaction has been rolled
back. See the nested exceptions for details on the errors that occu
rred.
at
kodo.runtime.PersistenceManagerImpl.throwFlushException(PersistenceManagerImpl.java:1262)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1122)
at
kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1005)
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:932)
at
kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:592)
at
com.ysoft.jdo.book.library.LibraryHandler.commitTransaction(LibraryHandler.java:175)
at
com.ysoft.jdo.book.library.client.CommitTransaction.execute(Library.java:279)
at
com.ysoft.jdo.book.common.console.UserInterface.execute(UserInterface.java:196)
at
com.ysoft.jdo.book.common.console.UserInterface.pumpCommands(UserInterface.java:186)
at
com.ysoft.jdo.book.library.client.Library.run(Library.java:139)
at
com.ysoft.jdo.book.library.client.Library.main(Library.java:104)
NestedThrowablesStackTrace:
kodo.util.DataStoreException: Invalid column type
at
kodo.jdbc.sql.DBDictionary.newDataStoreException(DBDictionary.java:3081)
at
kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:77)
at
kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:63)
at
kodo.jdbc.sql.SQLExceptions.getDataStore(SQLExceptions.java:43)
at
kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:89)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:445)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:193)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:95)
at
kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:609)
at
kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:153)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1122)
at
kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1005)
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:932)
at
kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:592)
at
com.ysoft.jdo.book.library.LibraryHandler.commitTransaction(LibraryHandler.java:175)
at
com.ysoft.jdo.book.library.client.CommitTransaction.execute(Library.java:279)
at
com.ysoft.jdo.book.common.console.UserInterface.execute(UserInterface.java:196)
at
com.ysoft.jdo.book.common.console.UserInterface.pumpCommands(UserInterface.java:186)
at
com.ysoft.jdo.book.library.client.Library.run(Library.java:139)
at
com.ysoft.jdo.book.library.client.Library.main(Library.java:104)
NestedThrowablesStackTrace:
java.sql.SQLException: Invalid column type
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at
oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6164)
at
oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1316)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.PoolConnection$PoolPreparedStatement.setNull(PoolConnection.java:406)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at
com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.setNull(LoggingConnectionDecorato
r.java:792)
at
com.solarmetric.jdbc.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:369)
at kodo.jdbc.sql.DBDictionary.setNull(DBDictionary.java:950)
at
kodo.jdbc.sql.OracleDictionary.setNull(OracleDictionary.java:450)
at kodo.jdbc.sql.RowImpl.toSQL(RowImpl.java:828)
at kodo.jdbc.sql.RowImpl.flush(RowImpl.java:1039)
at kodo.jdbc.sql.RowImpl.flush(RowImpl.java:975)
at
kodo.jdbc.runtime.PreparedStatementManager.flushInternal(PreparedStatementManager.java:160)
at
kodo.jdbc.runtime.PreparedStatementManager.flush(PreparedStatementManager.java:84)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:445)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:193)
at
kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:95)
at
kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:609)
at
kodo.runtime.DelegatingStoreManager.flush(DelegatingStoreManager.java:153)
at
kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:1122)
at
kodo.runtime.PersistenceManagerImpl.flushSafe(PersistenceManagerImpl.java:1005)
at
kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerImpl.java:932)
at
kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:592)
at
com.ysoft.jdo.book.library.LibraryHandler.commitTransaction(LibraryHandler.java:175)
at
com.ysoft.jdo.book.library.client.CommitTransaction.execute(Library.java:279)
at
com.ysoft.jdo.book.common.console.UserInterface.execute(UserInterface.java:196)
at
com.ysoft.jdo.book.common.console.UserInterface.pumpCommands(UserInterface.java:186)
at
com.ysoft.jdo.book.library.client.Library.run(Library.java:139)
at
com.ysoft.jdo.book.library.client.Library.main(Library.java:104)
enter command:
-->
Maybe you are looking for
-
Time Machine running on Linksys WRT600n with external drive.
Hey Folks, After searching the internet for the answer on how to setup OS X Time Machine on my Linksys WRT600n with storage link, and finding nothing or only parts of what I needed, I finally got it to work. Hopefully this will help you in your setup
-
I bought an iPad 2 about 8 weeks ago, having had iTunes and an iPod touch for about 3 years previously. From the moment I plugged the iPad into the laptop the above message pops up. Does anyone know how to fix this? Have deleted and reinstalled all i
-
Firewire problem on MacBook Pro
I have a 15" MacBook pro. I use it with a variety of firewrie devices, camera, video camera, hard drives and it has always worked flawlessly. Until two days ago. I woke it up from sleep and tried to mount a hard drive. The drive got power but the dri
-
When Syncing iTunes Takes 30 to 45 Minutes to recognize iPhone
Essentially the subject line tells it all. Is there a cache or setting that could be causing this. The recognition time seems to be getting longer. I use latest software and the iPhone is a 3GS. Any help would be appreciated.
-
SAP ABAP HR-payroll attendence Recorder
HI, implimantion is started related attendence swipe reader - we are useing RFC interface. once swipe the card i want to display - swipe card no ,emp no, timein After logout time Swipe the card i want to display - swipe card no ,emp no, timeout. W