2009-06-11 3 views
3

JDBC 연결을 실제로 작성하기 전에 언어를 지정하려고합니다. Oracle JDBC Thin Client 용 언어 설정

예를 들어 나는 내가 선택한 언어에 국한 ORA 오류가 필요

DriverManager.getConnection(url, user, password)  

에 잘못 L/P 자격 증명을 지정합니다. 오라클 씬 클라이언트를 사용하고 환경 변수 NLS_LANG을 설정하면 작동하지 않습니다.

답변

1

DriverManager.getConnection(String url, Properties info) 메서드를 사용하여 성공한 경우가 있습니다.

매개 변수 : 문서에서

url - 형태 JDBC의 데이터베이스 URL : 서브 프로토콜 : 하위 이름

info - 임의의 문자열 태그의 목록/값 쌍을 연결 인수로 사용합니다. 일반적으로 적어도 "user"및 "암호"속성은

을 포함해야

아마도이 같은 작동 할 수 있습니다

문서 당으로
String url = ...; 
Properties info = new Properties(); 
info.setProperty("user", ...); 
info.setProperty("password", ...); 
info.setProperty("NLS_LANG", ...); 
DriverManager.getConnection(url, info); 
+0

나는 그것을 시도했지만 그것은 나를 위해 작동하지 않습니다. :-( – sax

0

----

Providing Globalization Support 

The basic Java Archive (JAR) files, ojdbc5.jar and ojdbc6.jar, contain all the necessary classes to provide complete globalization support for: 

    Oracle character sets for CHAR, VARCHAR, LONGVARCHAR, or CLOB data that is not being retrieved or inserted as a data member of an Oracle object or collection type. 
    CHAR or VARCHAR data members of object and collection for the character sets US7ASCII, WE8DEC, WE8ISO8859P1, WE8MSWIN1252, and UTF8. 

To use any other character sets in CHAR or VARCHAR data members of objects or collections, you must include orai18n.jar in the CLASSPATH environment variable of your application. 
1

이를 내게 가장 잘 맞았습니다. NLS_LANG setting for JDBC thin driver?

-Duser.language=en -Duser.region=US 
+0

JDBC thin 드라이버가 Java Locale을 조사하여 언어를 추출한 다음 연결 설정 중 데이터베이스 세션 언어를 적절히 변경하기 때문에 작동합니다 .DB 세션의 언어는 오류 메시지를 적절한 언어로 반환하는 데 사용됩니다. –

관련 문제