开发者

question about timezone in postgresql+java?

开发者 https://www.devze.com 2023-03-06 16:51 出处:网络
I am usi开发者_如何转开发ng postgresql9.0 and JDK6. I am running pg_controldata command in postgresql. in that I need \"Time of latest checkpoint:\" value. it is a date & time with timezone.

I am usi开发者_如何转开发ng postgresql9.0 and JDK6. I am running pg_controldata command in postgresql. in that I need "Time of latest checkpoint:" value. it is a date & time with timezone.

while running through java API it is dispalying everything otherthan timezone.

from direct postgres it it showing ---Time of latest checkpoint:Mon 12 Mar 2012 08:15:43 AM SGT

but when run through code then it is showing----Time of latest checkpoint:Mon Mar 12 08:15:43 2012

how to solve it?

String result = 
pe.executepsql("/data/PostgreSQL/bin/pg_controldata /data/PostgreSQL/data"); 
System.out.println("Output of cmd:" +result); 
String start = "Time of latest checkpoint:"; 
String end = "Minimum recovery ending location:"; 
String str = result.substring(result.indexOf(start)+
"Time of latest checkpoint:".length(),result.indexOf(end)).trim(); 
System.out.println("Time of latest checkpoint: " +str); 
executepsql()

is used to execute postgres command.

executepsql() is used to execute postgres command.

I tried psql -c command also with this method which is working fine. but pg_controldata is not working correctly.


String result = pe.executepsql("/data/PostgreSQL/bin/pg_controldata /data/PostgreSQL/data");
System.out.println("Output of cmd:" +result);
String start = "Time of latest checkpoint:";
String end = "Minimum recovery ending location:";
String str = result.substring(result.indexOf(start)+"Time of latest checkpoint:".length(),result.indexOf(end)).trim();
System.out.println("Time of latest checkpoint: " +str);

executepsql() is used to execute postgres command.

I tried psql -c command also with this method which is working fine. but pg_controldata is not working correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消