Hello Cedric,

SAP DB's time stamp have a resolution of microseconds (1microsecond = 0. 000 001 s), 
wheras 1 nanosecond would be 0.000 000 001 second. 

Be sure to use a recent JDBC driver, has we had some problem with fractional seconds 
set 
to zero some time ago.

BTW, your program will clear out the fractional part of the milli seconds  by using 
Double.longValue() which might not have been what you want,
a long in java is maximal 2^63-1, so there is room in it for about 300 years even if 
the
time is expressed in nanoseconds ... 

Alexander Schr�der
SAP DB, SAP Labs Berlin 
-----Original Message-----
From: Cedric Cuche [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 11:53 AM
To: [EMAIL PROTECTED]
Subject: Timestamp support for nanosecond?


Hello, 
We should save into a database table some timestamp values. 
The documentation do not provide any information about nanosecond within a TIMESTAMP, 
but the size of the MILISECOND in the type is big enough to contain it....does it?
As an input, we have a double like "8476.12" with represent the delta in [ms] from an 
other date "2003.14.03:12:45:02". 
We use a java.sql.Timestamp rather than Date to hold this time (should handle 
nanosecond !)...here is the code to generate the Timestamp (with jdk.1.4.X).
Timestamp instant = new Timestamp(startDate.getTime()+new 
Double(inputtime).longValue()) 
instant.setNanos(instant.getNanos()+1234); //to be sure that timestamp has the 
nanoseconds within 
We then insert this instant time inside the SAPDB database using the sapdb jadbc 
driver. 
st.setTimestamp(3, instant); 
Does the sapdb TIMESTAMP store the nanosecond value of a java.sql.Timestamp object? 
Is there a better way to store this date/time with nanosecond information into a SAPDB 
instance? 
Thank a lot for any help 
Cedric 


Cedric Cuche
Software Development 
Chemspeed Ltd.
Rheinstrasse 32
CH-4302 Augst
phone: +41 (61) 816 95 00
fax: +41 (61) 816 95 09 
e-mail: [EMAIL PROTECTED]
visit our web-site: http://www.chemspeed.com 
<<Cedric Cuche.vcf>> 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to