Я пробовал проверить часовой пояс серверов с помощью date и datectl, но они идентичны обоим они находятся в часовом поясе GMT+3. Я также создал небольшое приложение для проверки JVM и часового пояса пользователя. Вот код:
Код: Выделить всё
System.out.println("JVM Time Zone : " + java.util.TimeZone.getDefault().getID());
System.out.println("User Time Zone : " + System.getProperty("user.timezone"));
System.out.println("Milliseconds : " + System.currentTimeMillis());
Date date = new Date(System.currentTimeMillis());
System.out.println(date.toString());
Код: Выделить всё
java -D[Standalone] -server -XX:+UseCompressedOops -verbose:gc -Xloggc:/opt/jboss-eap-6.4/standalone1/log/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms2048m -Xmx2048m -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.modules.policy-permissions=true -Dorg.jboss.boot.log.file=/opt/jboss-eap-6.4/standalone1/log/server.log -Dlogging.configuration=file:/opt/jboss-eap-6.4/standalone1/configuration/logging.properties -jar /opt/jboss-eap-6.4/jboss-modules.jar -mp /opt/jboss-eap-6.4/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/opt/jboss-eap-6.4 -Djboss.server.base.dir=/opt/jboss-eap-6.4/standalone1 -Djboss.server.base.dir=/opt/jboss-eap-6.4/standalone1 -Djboss.bind.address= -Djboss.bind.address.management= --server-config=standalone.xml
< strong>РЕДАКТИРОВАТЬ:
Вот код, который может воспроизвести проблему:
Код: Выделить всё
Class.forName("org.postgresql.Driver");
Connection conn = DriverManager.getConnection(String.format("jdbc:postgresql://%s:%s/%s", "IP", "PORT", "DB"), "USER", "PW");
CallableStatement st = conn.prepareCall("CALL \"DB\".storedProcedure('param1', 'param2', 'param3', 'param4', 'param5', '" + new Date() + "', '" + new Date() +"')");
st.executeUpdate();
Вот запрос, который может создать таблицу и хранимую процедуру, используемые в коде:
Код: Выделить всё
CREATE TABLE "DB"."table" (
"id" bigserial NOT NULL,
"col1" varchar(150) NULL,
"col2" varchar(30) NULL,
"col3" varchar(15) NULL,
"col4" varchar(150) NULL,
"col5" varchar(15) NULL,
"start" timestamp NULL,
"end" timestamp NULL,
CONSTRAINT id_pk PRIMARY KEY ("id"));
CREATE OR REPLACE PROCEDURE "DB".storedprocedure(param1 character varying, param2 character varying, param3 character varying, param4 character varying, param5 character varying, starttime timestamp without time zone, endtime timestamp without time zone)
LANGUAGE plpgsql
AS $procedure$
BEGIN
INSERT INTO "DB"."table"("col1" , "col2", "col3", "col4", "col5", "start", "end")
VALUES (param1, param2, param3, param4, param5, startTime, endTime);
END;
$procedure$
;
Код: Выделить всё
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: invalid input syntax for type timestamp: "Tue Jul 02 17:31:43 TRT 2024"
Position: 88
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162)
at org.postgresql.jdbc.PgCallableStatement.executeWithFlags(PgCallableStatement.java:83)
at org.postgresql.jdbc.PgCallableStatement.executeUpdate(PgCallableStatement.java:66)
at mymain.main(mymain.java:27)
Код: Выделить всё
Local time: Tue 2024-07-02 17:42:08 +03
Universal time: Tue 2024-07-02 14:42:08 UTC
RTC time: Tue 2024-07-02 14:42:08
Time zone: Europe/Istanbul (+03, +0300)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
Local time: Tue 2024-07-02 17:42:36 +03
Universal time: Tue 2024-07-02 14:42:36 UTC
RTC time: Tue 2024-07-02 14:42:36
Time zone: Europe/Istanbul (+03, +0300)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
- Оба сервера используют Java 1.8.0_302.
На обоих серверах установлено одно и то же приложение. - Оба сервера имеют одинаковый часовой пояс и время.
Подробнее здесь: https://stackoverflow.com/questions/786 ... t-linux-se