Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table date_test (some_date date)
- insert into date_test values (to_date('2015-03-13 02:20:21', 'yyyy-mm-dd hh24:mi:ss'));
- insert into date_test values (to_date('2016-03-13 02:20:21', 'yyyy-mm-dd hh24:mi:ss'));
- Properties props = new Properties();
- props.put("user", "*****");
- props.put("password", "****");
- Connection con =
- DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", props);
- ResultSet rs = stmt.executeQuery("select * from date_test");
- while (rs.next()) {
- System.out.println("via String: " + rs.getString(1));
- System.out.println("via Timestamp: " + rs.getTimestamp(1));
- }
- rs.close();
Add Comment
Please, Sign In to add comment