Guest User

Untitled

a guest
Mar 8th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. create table date_test (some_date date)
  2. insert into date_test values (to_date('2015-03-13 02:20:21', 'yyyy-mm-dd hh24:mi:ss'));
  3. insert into date_test values (to_date('2016-03-13 02:20:21', 'yyyy-mm-dd hh24:mi:ss'));
  4.  
  5. Properties props = new Properties();
  6. props.put("user", "*****");
  7. props.put("password", "****");
  8. Connection con =
  9. DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", props);
  10. ResultSet rs = stmt.executeQuery("select * from date_test");
  11. while (rs.next()) {
  12. System.out.println("via String: " + rs.getString(1));
  13. System.out.println("via Timestamp: " + rs.getTimestamp(1));
  14. }
  15. rs.close();
Add Comment
Please, Sign In to add comment