Java Timestamp comparision
hi folks,
I want to do a timestamp comparision between to set of times.
For example, i have one timestamp stored in my DB table (mysql 5) as timestamp:
Time1 = "14.07.2010 15:30:00"
Now in my java program, i get the above timestamp and then get the 2nd timestamp as current time. Timestamp Time2 = new Timestamp(System.currentTimeMillis() what I want to campare now is the above 2 timestamps and check if the difference is older than 1 hour.
If the difference is older than 1 hour then do thing A otherwise do thing B.
thanks
if ((time2.getTime() - time1.getTime()) > 3600000l) { // older than 1 hour
Similar Messages
-
How to convert oracle timestamp to java timestamp
Hi,
I need to convert oracle timestamp that i got from oracle database to java timestamp.I tried to use getTimestamp() to get timestamp value from oracle, but am getting NumberFormatException.
Could any of suggest how to convert oracle timestamp to java timestamp.Thanks jverd ,
then my code will be like:
String oracleTS="11-MAR-05 11.19.20.625 AM";
// am looking for yyyy-MM-dd HH:mm:ss format
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss");
Timestamp javaTimestamp=Timestamp.valueOf(oracleTS);
System.out.println("javaTimestamp----->>
"+javaTimestamp);
ving java.lang.NumberFormatException: For input
string: "MAR"Well, the SimpleDateFormat has to actually match the format you're trying to parse, for one thing. Then you have to actually USE the SDF, which you didn't.
You really haven't made it clear what you're trying to do, and it doesn't appear that you bothered to study the links I provided.
DateFormat df = new SimpleDateFormat("dd-MMM-yy HH.mm.ss.SSS aa");
Date date = df.parse(oracleTS);
Timestamp ts = new Timestamp(date.getTime()); -
Oracle/java timestamp data type error.. please help
Im having trouble with a SQL query of mine. Im trying to get a timestamp using JDBC from an oracle database however i get the following error:
java.sql.SQLException: ORA-00932: inconsistent datatypes: expected %s got %s
Now when i put the java.util.timestamp into the DB it appears to change.
When I printout the value of the timestamp in my console it prints the following:
07-06-26 17:28:09.414
When i check the value from SQL PLUS it gives me this value
07-06-26 17:28:09,000000
Does anyone have any idea why this happens? and more importantly how I can retrieve the timestamp again.
Im using BEA workshop which means i dont have any means of manipulating the data before presenting to the frontend.
The database is Oracle 9.2.0.1user582245,
Please provide the following:
1. Entire error message and stack trace you are getting.
2. Part of your code where the error occurs.
3. JDK version you are using.
4. Oracle data-type of the problematic column.
Good Luck,
Avi. -
Having problem with java Timestamp
Hey guys,
I'm creating a Timestamp variable and then passing that variable to a method which is populating the Timestamp variable.
When I get the value back its still null. Aren't all objects pass by reference? Am I missing something.
Here is the code that I'm using
Timestamp tStamp=null;
boolean returnValue=someMethod(tStamp);
I've checked the value of tStamp inside method and its getting populating but after the method call value of tStamp stays null.
Please let me know what I'm doing wrong.
Thankssam2020 wrote:
In other words if a Object is instantiated then its value would be retained after it is changed in the method. Err...kind of. A reference is something that can be pointed to any object of an agreeable type, and has little to do with any particular object. For instance, you could do this
Object ts = new Object();
ts = new Object();
ts = new Object();
ts = new Object();
ts = new Object();
ts = new Object();
ts = new Object();At this point, ts has pointed to 8 completely separate objects, but you've only used one reference. Each time you reassign ts to a different Object, all references to the previously referenced objects have been lost and the Object will eventually be garbage collected.
Similarly you can create an Object without ever having assigned it to a reference:
new Object();
new Object();
new Object();
new Object();
new Object();
new Object();
new Object();
new Object();This time, you've created 8 objects and have never even used a reference.
Think of a reference as a plate of food.
When you take a plate out of the cupboard, it's not linked to any specific food, even if there is a bunch of food in your fridge. This is similar to:
Object plate; //or Object plate = null;You could bake a cake, but this has nothing to do with your plate...yet.
Object cakePan = new Object(); //bake a cake...but it's not on your plate yet!Then you can transfer the cake to your plate
Object plate = cakePan; //now plate is holding your new cake...but that doesn't make your plate a cake!Of course you could always scrape the rest of the cake into the garbage:
Object plate = null;Or put something else on it instead:
Object plate = fridge.takePizza();But the point is, your plate isn't tied down to what's on it. Just like a reference isn't tied (or even very much related) to what it points to. (Unless you use the final keyword).
Can you tell I'm hungry?
Edit:
To tie this into your original question, when you call a method, you could pass the reference (plate) by value or by reference.
So if you wanted to give your brother the rest of your cake, you could either:
a) Pass him the plate (pass by reference). This would allow him to replace the contents of the place before he gives it back to you. Or,
b) Move the cake to his plate (pass by value). This means he can change the cake (eat some, whatever), but he can't change what's on YOUR plate.
Java always uses b).
This analogy of course breaks down when you realize that with references, multiple references can reference the same object, but you can't put a single piece of cake on multiple plates.
Edited by: endasil on 16-May-2008 4:36 PM -
Java IDE comparision 2007 ( netbeans , eclipse , jbuilder )
Hi there
I have been searching for this answer for long time , no clear work was done on it .
Can I at least get latest compasition between
1) netbeans
2) eclipse
3) myeclipse
4) jbuilder
thanksgeorgemc wrote:
jwenting wrote:
georgemc wrote:
nasert wrote:
georgemc , I totally agree with u , I am just curious to know about such a comparision .Then you need to provide the dimensions of that comparison. The quality of each IDE is mostly subjective, so you need to say what you're comparingIt isn't, not really.
Notbeans is so far behind the rest of the world it's not worthy of consideration.
The other 3 mentioned are all Eclipse (though 2 of them with some plugins to make them look more fancy).
None can compare with IntelliJ.Between your answer and Kaj's answer below, you've managed to confirm that, yes, it actually is subjective! Can't argue with the fact that some people think Netbeans is the best thing since sliced breadWell, that depends on whether Kaj was serious (I doubt it, I've never seen someone say with a straight face that Netbeans was superior to anything). -
Comparing 2 Timestamps in an SQL Query
Hi all,
I'm connecting to an Oracle Database by JDBC und now I'm trying to compare the stored Timestamp-Object with another Java-TimestampObject. My Query looks like that:
select *
from table
where date.getTimestamp() > old_date
The first 'date' names the head of column und 'old_date' is a Java-Timestamp. I receive the following error:
ORA-00933: The Query could not be correctly ended
Who can help me???It looks to me like you're trying to use the Java getTimestamp() function call in Oracle, which isn't going to work.
I suspect that you want to do something along the lines of
- prepare the query "select * from table where date > ?"
- bind the Java timestamp variable you have to the '?' above
- execute the statement
What version of the database and JDBC driver are you using? Is the "date" column a "date" or a "timestamp"?
Justin -
Change a timestamp in one timezone to another with the DayLight Saving
Hi Guys!
I need to change a timestamp in one timezone to another timezone with the Daylight saving time(DST).
I can easily convert a given timestamp to a different location timezone by the use of TimeZone class in java, but found myself unable to modify it relative to the
Daylight saving time(DST).
I Just want to know that the companies, that are having the International clients then, how they handle these kind of things where they need to track down the user
activity in that client(End-User) side timezone, with that Daylight Saving Time.
I am very new to this Daylight saving time concept so if anybody knows about it anything, then plz help me out.venus_goyal wrote:
Hi Guys!
I need to change a timestamp in one timezone to another timezone with the Daylight saving time(DST).
I can easily convert a given timestamp to a different location timezone by the use of TimeZone class in java, but found myself unable to modify it relative to the
Daylight saving time(DST).No you don't. All Java timestamps are stored as a "epoch time" i.e. number of millisecondsseconds since 1/1/1970 GMT.
Conversion to and from local dates and times is done when converting between stored Date objects and String values from input or for display.
This happens in DateFormat or Calendar, and DST information is included in the Locale information passed to either class. -
Does anyone know how to insert a valid java timestamp (or even systimestamp) into a 9i timestamp column? What seems to be happening is the milli value is being rounded up to six digits no matter what. For example:
java.sql.TimeStamp=13:22:45.384
Oracle timestamp(9) column gets=13:22:45.000000000
Behind the scenes, we have found it does=13:22:45.000000384
which rounds to 000000000
I also noticed that the Enterprise Management console does not support TIMESTAMPS when I try to alter the table. As soon as you click on the timestamp column, it switches to CHAR. Am I using some weird version of the drivers? We had a problem like this a few years ago with Sybase, but we fixed it be changing odbc drivers.
Thanks,
LouHi,
Inserting the systimestamp into a timestamp column from SQL Plus
INSERT INTO TimeTable(timestampcol)
VALUES(CURRENT_TIMESTAMP);
The current timestamp with milli seconds precision upto 6 will be inserted.
Inserting into a timestamp column from java
Timestamp currentTimeStamp = new Timestamp(System.currentTimeMillis());
pstmt.setTimestamp(colindex,currentTimeStamp);
Regards
Elango. -
TimeStamp - for Today , this week , this month and year
Hello I have data in Java TimeStamp in a DB2 database.
While Acessing the data using JDBC I would need to get data based on
1/Today
2.This week
3.This Month
4.And this year
So how do I get the Timestamps for the Starting and ending Timestamps ....
i.e say Last week I would need
Present TimeStamp and Timestamp of exactly 7 days ago ....
Can you please give me an example regarding this ....Use Timestamps as well as java.util.Calendar
And what about the hours, minutes and seconds? -
I am writing a date generating routine based on the default DateFormat timestamp masks/time pattern Strings. This cycles through different Locales, and gives you the mask for each Locale for short, medium, long, and full format. For an API to an external script, I will need to hash the available Java timestamp masks vs. some predefined masks of my own.
My question is this. When I review the available Locales' timestamp masks, there are symbols I don't see listed in the documentation for SimpleDateFormat. For example, a.n.j. is one mask that is listed. There is no "j" symbol listed here:
http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html
Does anybody know where I can get a complete list of definitions for these time pattern symbols?
-JeffAre you using "toLocalizedPattern()" when you print the pattern Strings? toLocalizedPattern() returns the pattern String of DateFormat in a locale specific format... meaning if the locale is set to de.DE (Germany), toPattern will return dd.MM.yy (for SHORT), but toLocalizedPattern will return tt.MM.uu (tag for day and Uhr for year). Could this be what you are seeing?
-
Hi,
I'm trying to migrate my postgresql database to oracle express 10 on rhel 5. All seems ok. My application use tomcat and hibernate to access database. I have a problem between java timestamp and oracle timestamp.
When I set hibernate in verbose mode, I can see the sql string generated. Here is an exemple:
SQL> select * from etat_materiel where date_<='2008-06-19 11:17:55.433'; select * from etat_materiel where date_<='2008-06-19 11:17:55.433' * ERROR at line 1: ORA-01843: not a valid month
Apparently it's not the good format for sql timestamp, but I can't find where in hibernate I can specify another way of creating this sql string.
Does anybody have been confronted to the same problem ?
Regards.
PS: I use
- tomcat 6
- hibernate 3.2
- oracle express 10 on rhel5I have the same problem. It seems that the 'encoding' for the timestamp type is various and is defined as a system/database-wide property named NLS_TIMESTAMP_FORMAT. You can check for it here:
select * from sys.prop$ where 1=1;
what I have found out as well is that you can change the value of this property using ALTER SESSION:
alter session set NLS_TIMESTAMP_FORMAT = 'RRR-MM-DD HH:MI:SS.FF'
(this reflects your query string).
There is a way to use your SQL query string using TO_TIMESTAMP function:
SQL> select * from etat_materiel where date_<='2008-06-19 11:17:55.433';
select * from etat_materiel where date_<=to_timestamp('2008-06-19 11:17:55.433', 'RRRR-MM-DD HH:MI:SS.FF');
This should work for you.
My problem is somewhat different - I am using Hibernate Query Language (HQL) to get my Java objects from the database. I'm hitting the wall like you do because when I use similarly formatted 'WHERE' clause, HQL translates it directly to SQL. I am not sure if HQL will accept native Oracle SQL function 'TO_TIMESTAMP' - probably not... so I'm not clear what to do. It would be nice to be able to include the NLS_TIMESTAMP_FORMAT somewhere at the beginning of the hibernate session... -
SQLServer date / timestamp problems ?
Hi,
I am having trouble reading a timestamp field from sql server. Java 1.3/SQLServer 7 SP1, ODBC:JDBC bridge
We can access other datatypes OK but get the error
[Microsoft][ODBC SQL Server Driver]Restricted data type attribute violation
when we try to read a timestamp or datetime value, using getTimestamp or getDate.
Can anyone explain this error ?
java.sql.Date myDate;
java.sql.Timestamp myTimestamp;
java.util.Calendar cal = java.util.Calendar.getInstance();
java.util.TimeZone tz = java.util.TimeZone.getTimeZone("GMT");
String d;
try{
myTimestamp = r.getTimestamp("fldDate", cal);
System.out.println("Got timestamp");
System.out.println("timestamp is "+myTimestamp.toString() );
catch( SQLException e) {
System.out.println("Timestamp failed"+e);
try{
myDate = r.getDate("fldDate");
d=myDate.toString();
System.out.println("Date :"+d);
catch( SQLException e) {
System.out.println("Date failed"+e);You can fix your problem with SQLServer timestamps simply making a minor change.
SQLServer timestamps are, in fact Binary big integers. So, for example if you have a Country table and you select it as:
Select
[CountryID],
[Name],
user_name([InsertUser]) AS InsertUser,
[InsertDate],
user_name([ModifyUser]) AS ModifyUser,
[ModifyDate],
ts
From Country
Order By [CountryID]
Then you will get a problem because Java timestamp are Dates types. To fix the problem, just add a Convert function, like this:
Select
[CountryID],
[Name],
user_name([InsertUser]) AS InsertUser,
[InsertDate],
user_name([ModifyUser]) AS ModifyUser,
[ModifyDate],
Convert(bigint, [ts]) AS ts
From Country
Order By [CountryID]
And finally, from your Java code, read this column as a BigInt.
RDC -
How do I change TimeStamp from US server to UK time
Hello,
I am based in the UK. My hosting company is based in the US. I am using a MySql database. All the database tables have timestamps that are set to the local machine time.
I would like to change the timestamp so that it is GMT.
Can you please tell me how I would go about doing this?
Is their any code available to enable me to insert the timestamp as a GMT date or do I set the value from the mysql database end.
Thanks
AndrewTimestamp values in Java (java.sql.Timestamp) are GMT internally (actually, they're implemented as a long giving the number of milliseconds since 1. january, 1970).
Date values in SQL, on the other hand, are normally stored in the local time zone.
What you need to do, is tell JDBC what time zone you want the stored values to be in, like this:
When inserting (using a PreparedStatement):
stmt.setTimestamp(column, myTimestamp, Calendar.getInstance(TimeZone.getTimeZone("GMT")));When reading back from a ResultSet:
Timestamp ts = rs.getTimestamp(column, Calendar.getInstance(TimeZone.getTimeZone("GMT")));Now, you know that the timestamp value you've read back from the database does not have any bias to it introduced by the local timezone of the database server. The next step is to represent the Java Timestamp value to the user, and at this stage you may want to specify which time zone you want for the rendered timestamp, like this:
import java.text.DateFormat;
import java.text.SimpleDateFormat;
// convert the Timestamp to a String in a controlled manner
// see the documentation for SimpleDateFormat for how you specify the format string
DateFormat df = new SimpleDateFormat("yyyy.MM.dd HH.mm.ss");
// need to set the time zone, or the server's time zone will be used
// if you can somehow figure out the time zone where the user is
// sitting, you may use that instead, to provide dates relative to
// the user instead of the server
df.setTimeZone(TimeZone.getTimeZone("GMT"));
String outValue = df.format(myTimestamp);
// output the converted value, maybe
System.out.println(outValue);Similarly, you may use the parse() method of DateFormat to parse a String as a java.util.Date, which may then be converted into a Timestamp.
The general principles are as follows:
- internally, Java Timestamps, Dates etc. are stored relative to 1. january 1970, GMT
- when getting date values into or out of Java, time zones may have to be considered
- for converting to/from Strings (eg. for UI purposes), use the java.text.DateFormat class
- for communicationg with an SQL database via JDBC, use the set/get-Timestamp methods with the added Calendar argument
NB! Please be aware that I didn't actually try to compile this code, so bugs may be present. -
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) violatedKK,
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 -
DB timestamp value with JVM TimeZone
Hi all,
If we have database timestamp "*1970-01-01T16:00:00*", no matter what Time Zone the jvm is running with, we get the java.sql.Timestamp object representing the time "1970-01-01T16:00:00" locally(Shang Hai, Las Vegas, London...). So, the UTC time will be different as well.
I need to do some conversion work to make database timestamp "1970-01-01T16:00:00" as UTC time. Although it will be different in jvms with different time zones, they all mean the same time(UTC time, same million seconds from UTC Time 1970-01-01T00:00:00.000) and will be consistent.
For how to do the conversion, do you have any suggestion?Seems like an odd request.
1. If your database does NOT specify a timezone then the jdbc connection string would have a way to do that explicitly.
2. If you database DOES specify a timezone then you would need to write SQL (not java) that returned a unspecified timezone value, probably a string, which you would use to create a java timestamp (for example via SimpleDateFormat).
The above or course presumes that you understand that the jdbc has perfectly acceptable ways of getting correct timestamps from databases and that displaying a timestamp value has nothing to do with that.
Maybe you are looking for
-
Reading Text Files using Oracle PL/SQL and UTL_FILE
Hi, experts. I tried to read a text file into oracle. Here is what i did: 1. Create a text file in the directory: C:\temp\New Text Document.txt 2. Run the following SQL in PL/SQL: CREATE or replace DIRECTORY sampledata AS 'C:\temp\'; grant read, writ
-
Exporting data from JSP to EXCEL
Hi All, I am getting data in form of table in my jsp page. I need to know how to export the data in excel sheet with a click of button. Please help me. Thanks
-
SAP Interface to PathGuide Latitude WMS
Hi All, Has anyone ever have experience of interfacing to this Warehouse Management System software using SAP? If so, what ABAP technology are we talking about? BAPI? Flat file? Even IDocs? etc Thanks, Niall Message was edited by: Niall F
-
Reader X: Read Out Loud function not working; no voice output
I was using this function in the Reader 9.4 but the voice got the text a bit garbled at times, so I thought I'd try the latest version of the Reader and see if the passage was less garbled. Reader X has no voice output at all, even after setting and
-
In Acrobat CIB,lesson 19, why can't I edit the reading order?
Images are supposed to be 1,3,5 and their captions 2,4,6. My issue is that they switch...okay, i draw my rectangle around image 1 click the figure button in the TouchUp Reading Order dialog box, then draw my rectangle around caption 1 and click the