program story

ORA-01882 : 시간대 영역이 없습니다

inputbox 2020. 9. 5. 09:54
반응형

ORA-01882 : 시간대 영역이 없습니다


Java 응용 프로그램에서 Oracle 데이터베이스에 액세스하고 있는데 응용 프로그램을 실행할 때 다음 오류가 발생합니다.

java.sql.SQLException : ORA-00604 : 재귀 SQL 레벨 1에서 오류가 발생했습니다. ORA-01882 : 시간대 영역을 찾을 수 없습니다.


Oracle jdbc 드라이버 및 Oracle 데이터베이스의 버전을 확인할 수도 있습니다. 오늘 바로 ojdbc6.jar (버전 11.2.0.3.0)을 사용하여 Oracle 9.2.0.4.0 서버에 연결할 때이 문제가 발생했습니다. ojdbc6.jar 버전 11.1.0.7.0으로 바꾸면 문제가 해결되었습니다.

또한 oracle.jdbc.timezoneAsRegion=falseoracle / jdbc / defaultConnectionProperties.properties 파일 (jar 내부) 을 추가하여 ojdbc6.jar 버전 11.2.0.3.0을 오류없이 연결하도록 관리했습니다 . 여기 에서이 솔루션을 찾았 습니다.

마지막 으로이 표기법을 사용하는 구성 파일 -Doracle.jdbc.timezoneAsRegion=false의 명령 줄 또는 AddVMOption -Doracle.jdbc.timezoneAsRegion=false추가 수 있습니다.


일반 SQL 개발자 설치에서 Windows에서 디렉토리로 이동

C:\Program Files\sqldeveloper\sqldeveloper\bin

추가

AddVMOption -Duser.timezone=CET

파일에 sqldeveloper.conf.


내가 얻은 오류 :

db_connection.java 오류->> java.sql.SQLException : ORA-00604 : 재귀 SQL 레벨 1에서 오류가 발생했습니다. ORA-01882 : 시간대 영역을 찾을 수 없습니다.

ORA-00604 : 재귀 SQL 레벨 1에서 오류가 발생했습니다 ORA-01882 : 시간대 영역을 찾을 수 없습니다

이전 코드 :

 public Connection getOracle() throws Exception {
     Connection conn = null;
     Class.forName("oracle.jdbc.driver.OracleDriver");
     conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:tap", "username", "pw");
     return conn;
}

새 코드 :

 public Connection getOracle() throws Exception {
     TimeZone timeZone = TimeZone.getTimeZone("Asia/Kolkata");
     TimeZone.setDefault(timeZone);
     Connection conn = null;
     Class.forName("oracle.jdbc.driver.OracleDriver");
     conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:tap", "username", "pw");
     return conn;
}

이제 작동합니다 !!


아래 행을 포함하기 위해 사용중인 라이브러리 버전 (즉, jar 내부)에서 oracle / jdbc / defaultConnectionProperties.properties 파일을 업데이트하십시오 .

oracle.jdbc.timezoneAsRegion=false

일어나는 일은 JDBC 클라이언트가 시간대 ID를 서버에 보내는 것입니다. 서버는 해당 영역을 알아야합니다. 다음으로 확인할 수 있습니다.

SELECT DISTINCT tzname FROM V$TIMEZONE_NAMES where tzname like 'Etc%';

'Etc / UTC'및 'UTC'(tzfile 버전 18)에 대해 알고있는 일부 db 서버가 있지만 다른 일부는 'UTC'(tz 버전 11) 만 알고 있습니다.

SELECT FILENAME,VERSION from V$TIMEZONE_FILE;

JDBC 클라이언트 측에서도 다른 동작이 있습니다. 11.2부터 드라이버는 시간 오프셋을 전송하기 전에 Oracle에 "알려진"영역 ID를 전송합니다. 이 "알려진 ID 전송"의 문제점은 클라이언트가 서버에있는 시간대 버전 / 컨텐츠를 확인하지 않고 자체 목록을 가지고 있다는 것입니다.

이는 Oracle 지원 문서 [ID 1068063.1]에 설명되어 있습니다.

또한 클라이언트 OS에 의존하는 것처럼 보이며 RHEL 또는 Windows보다 Ubuntu에서 Etc / UTC가 실패 할 가능성이 더 큽니다. 나는 이것이 약간의 정규화 때문이라고 생각하지만 정확히 무엇을 알지 못했습니다.


  1. 이클립스에서 실행 -> 구성 실행

  2. in there go to JRE tab in right side panels

  3. in VM Arguments section paste this

    -Duser.timezone=GMT

  4. then Apply - > Run


I had this problem when running automated tests from a continuous integration server. I tried adding the VM argument "-Duser.timezone=GMT" to the build parameters, but that didn't solve the problem. However, adding the environment variable "TZ=GMT" did fix it for me.


ERROR :

ORA-00604: error occurred at recursive SQL level 1 ORA-01882: timezone region not found

Solution: CIM setup in Centos.

/opt/oracle/product/ATG/ATG11.2/home/bin/dynamoEnv.sh

Add this java arguments:

JAVA_ARGS="${JAVA_ARGS} -Duser.timezone=EDT"

In Netbeans,

  1. Right-click your project -> Properties
  2. Go to Run (under Categories)
  3. Enter -Duser.timezone=UTC or -Duser.timezone=GMT under VM Options.

Click Ok, then re-run your program.

Note: You can as well set to other timestones besides UTC & GMT.


I ran into this problem with Tomcat. Setting the following in $CATALINA_BASE/bin/setenv.sh solved the issue:

JAVA_OPTS=-Doracle.jdbc.timezoneAsRegion=false

I'm sure that using one of the Java parameter suggestions from the other answers would work in the same way.


If this problem is in JDeveloper: Change the project properties for both the model and the view project -> run/debug -> default profile -> edit add the following run option: -Duser.timezone=Asia/Calcutta

Make sure that the above time zone value is fetched from your database as follows:

select TZNAME from V$TIMEZONE_NAMES;

Along with that you'd want to check the time zone settings in your jdev.conf as well as in the JDeveloper -> Application Menu -> Default Project Propertes -> Run/Debug -> Default Profile -> Run Options.


I too had the same problem when i tried to create connection in JDeveloper. Our server located in different timezone and hence it raised the below errors as:

ORA-00604: error occurred at recursive SQL level 1 

ORA-01882: timezone region not found

I referred many forums which asked to include timezone in the Java Options(Run/Debug/Profile) of Project properties and Default Project properties as -Duser.timezone="+02:00" bBut it didn't work for me. Finally the following solution worked for me.

Add the following line to the JDeveloper's configuration file (jdev.conf).

AddVMOption -Duser.timezone=UTC+02:00

The file is located in "<oracle installation root>\Middleware\jdeveloper\jdev\bin\jdev.conf".


In my case I could get the query working by changing "TZR" with "TZD"..

String query = "select * from table1 to_timestamp_tz(origintime,'dd-mm-yyyy hh24:mi:ss TZD') between ?  and ?";

I also same faced similar issue.

Environment:

Linux, hibernate project, ojdbc6 driver while querying oracle 11g database.

Resolution

TZ parameter was not set in linux machine, that basically tell oracle about the timezone. So, After adding export statment "export TZ=UTC" at time of application start solved my problem.

UTC--> Change accorind to your timezone.


I was able to solve the same issue by setting the timezone in my linux system (Centos6.5).

Reposting from

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html

  1. set timezone in /etc/sysconfig/clock e.g. set to ZONE="America/Los_Angeles"

  2. sudo ln -sf /usr/share/zoneinfo/America/Phoenix /etc/localtime

To figure out the timezone value try to

ls /usr/share/zoneinfo

and look for the file that represents your timezone.

Once you've set these reboot the machine and try again.


Facing the same issue using Eclipse and a distant Oracle Database, changing my system time zone to match the time zone of the database server fixed the problem. Re-start the machine after changing system time zone.

I hope this can help someone


java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-01882: timezone region not found

For this type of error, just change your system time to your country's standard GMT format

e.g. Indian time zone is chennai,kolkata.


I had the same problem when trying to make a connection on OBIEE to Oracle db. I changed my Windows timezone from (GMT+01:00) West Central Africa to (GMT+01:00) Brussels, Copenhagen, Madrid, Paris. Then I rebooted my computer and it worked just fine. Seems like Oracle was not able to recognize the west central Africa timezone.

참고URL : https://stackoverflow.com/questions/9156379/ora-01882-timezone-region-not-found

반응형