import java.sql.*;
import java.lang.*;
import java.math.*;

public class test {
	public static void main (String[] args) throws Exception {
		Class.forName("org.postgresql.Driver");
		Connection conn = DriverManager.getConnection("jdbc:postgresql:DB1", "cts1","");

		java.util.Calendar cal = java.util.Calendar.getInstance();
		String[] ids = (java.util.TimeZone.getAvailableIDs());
		for (int i=0;i<ids.length;i++)
		{
		if (ids[i].toString().equalsIgnoreCase("est"))
			System.out.println("found est");
		if (ids[i].toString().equalsIgnoreCase("pst"))
			System.out.println("found pst");
		}

		cal.setTimeZone(java.util.TimeZone.getTimeZone("PST"));
		PreparedStatement d = conn.prepareStatement("insert into notime values(?)");
		d.setTime(1,Time.valueOf("12:00:00"),cal);
		d.executeUpdate();
		d = conn.prepareStatement("insert into notimestamp values(?)");
		d.setTimestamp(1,Timestamp.valueOf("1999-12-31 12:00:00"),cal);
		d.executeUpdate();

		d = conn.prepareStatement("insert into time values(?)");
                d.setTime(1,Time.valueOf("12:00:00"),cal);
                d.executeUpdate();
                d = conn.prepareStatement("insert into date values(?)");
                d.setDate(1,Date.valueOf("1999-12-31"),cal);
                d.executeUpdate();
                d = conn.prepareStatement("insert into timestamp values(?)");
                d.setTimestamp(1,Timestamp.valueOf("1999-12-31 12:00:00"),cal);
                d.executeUpdate();

                cal.setTimeZone(java.util.TimeZone.getTimeZone("EST"));
                d = conn.prepareStatement("insert into notime values(?)");
                d.setTime(1,Time.valueOf("12:00:00"),cal);
		d.executeUpdate();
                d = conn.prepareStatement("insert into notimestamp values(?)");
                d.setTimestamp(1,Timestamp.valueOf("1999-12-31 12:00:00"),cal);
                d.executeUpdate();

		d = conn.prepareStatement("insert into time values(?)");
                d.setTime(1,Time.valueOf("12:00:00"),cal);
                d.executeUpdate();
                d = conn.prepareStatement("insert into date values(?)");
                d.setDate(1,Date.valueOf("1999-12-31"),cal);
                d.executeUpdate();
                d = conn.prepareStatement("insert into timestamp values(?)");
                d.setTimestamp(1,Timestamp.valueOf("1999-12-31 12:00:00"),cal);
                d.executeUpdate();
//		cal.setTimeZone(java.util.TimeZone.getTimeZone("EST"));
//		CallableStatement cstmt = conn.prepareCall("{? = call getTime()}");
//		cstmt.registerOutParameter(1,java.sql.Types.TIME);
//		ResultSet rs = cstmt.executeQuery();
//		System.out.println(cstmt.getTime(1,cal));
		

}}
