Filing bug as an issue holder.
inet oracle driver truncates nanos while saving timestamps into database. Here is a test to reproduce it.
void timestampTest() throws SQLException {
// Execute following DDL.
//create table test (DATATYPESID varchar2(255), TIMESTAMPDATA TIMESTAMP(9) );
//
//Insert Timestamp with nanos set to 23
PreparedStatement ps = conn.prepareStatement("insert into test (DATATYPESID, TIMESTAMPDATA) values (1, ?)");
Timestamp ts = new Timestamp(0);
ts.setNanos(23);
System.out.println("Saved Timestamp = " + ts);
ps.setTimestamp(1, ts);
ps.executeUpdate();
conn.commit();
//Query the timestamp back. It shows nanos as 0. Even in database, the nanos is showed as 0
ps = conn.prepareStatement("select TIMESTAMPDATA from test where DATATYPESID = '1'");
ResultSet rs = ps.executeQuery();
rs.next(); Timestamp retrievedTs = rs.getTimestamp(1);
System.out.println("Retrieved Timestamp = " + retrievedTs);
}
Running with oracle 9 driver, we get following output
Saved Timestamp = 1969-12-31 16:00:00.000000023
Retrieved Timestamp = 1969-12-31 16:00:00.000000023
Running with inet driver, we get following output
Saved Timestamp = 1969-12-31 16:00:00.000000023
Retrieved Timestamp = 1969-12-31 16:00:00.0
###@###.### 2003-10-08
###@###.### 2004-06-16
inet oracle driver truncates nanos while saving timestamps into database. Here is a test to reproduce it.
void timestampTest() throws SQLException {
// Execute following DDL.
//create table test (DATATYPESID varchar2(255), TIMESTAMPDATA TIMESTAMP(9) );
//
//Insert Timestamp with nanos set to 23
PreparedStatement ps = conn.prepareStatement("insert into test (DATATYPESID, TIMESTAMPDATA) values (1, ?)");
Timestamp ts = new Timestamp(0);
ts.setNanos(23);
System.out.println("Saved Timestamp = " + ts);
ps.setTimestamp(1, ts);
ps.executeUpdate();
conn.commit();
//Query the timestamp back. It shows nanos as 0. Even in database, the nanos is showed as 0
ps = conn.prepareStatement("select TIMESTAMPDATA from test where DATATYPESID = '1'");
ResultSet rs = ps.executeQuery();
rs.next(); Timestamp retrievedTs = rs.getTimestamp(1);
System.out.println("Retrieved Timestamp = " + retrievedTs);
}
Running with oracle 9 driver, we get following output
Saved Timestamp = 1969-12-31 16:00:00.000000023
Retrieved Timestamp = 1969-12-31 16:00:00.000000023
Running with inet driver, we get following output
Saved Timestamp = 1969-12-31 16:00:00.000000023
Retrieved Timestamp = 1969-12-31 16:00:00.0
###@###.### 2003-10-08
###@###.### 2004-06-16