Package oracle.i18n.util
Class OraSQLUtil
- java.lang.Object
-
- oracle.i18n.util.OraSQLUtil
-
public class OraSQLUtil extends Object
TheOraSQLUtilclass is an Oracle SQL utility class.The following functionality is available in this class:
- Data Validation - validates whether data can be stored safely into the database in the specified character set.
-
Data Conversion - converts all characters that cannot be stored in the
database in the specified charcter set into Unicode escape forms, such as
\[0-9A-Z]{4}, for theUNISTRfunction - Database session synchronization - synchronizes the NLS database session parameters with the Java locale or the Oracle language and territory
- Since:
- 10.1.0.2
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringescapeUNISTR(String str, String dbCharset)Escapes the string intoUNISTRform if the character is not supported by the database character set.static booleanisValidIdentifier(String srcstr, String dbCharset)Checks if the string is valid in the database character set.static booleansynchronizeLocale(String oralanguage, String oraterritory, Connection con)Synchronizes the database session NLS parameters with the Oracle language and territory names.static booleansynchronizeLocale(Locale locale, Connection con)Synchronizes the session NLS parameters with the locale.
-
-
-
Method Detail
-
isValidIdentifier
public static boolean isValidIdentifier(String srcstr, String dbCharset) throws UnsupportedEncodingException
Checks if the string is valid in the database character set.- Parameters:
srcstr- a string to be examineddbCharset- Oracle database character set name- Returns:
trueif the data is valid in the database character set, otherwisefalse- Throws:
UnsupportedEncodingException- if thedbCharsetparameter is invalid
-
escapeUNISTR
public static String escapeUNISTR(String str, String dbCharset) throws UnsupportedEncodingException
Escapes the string intoUNISTRform if the character is not supported by the database character set.- Parameters:
str- a string to be examineddbCharset- Oracle database character set name- Returns:
- a
UNISTRstring containing Unicode escaped form if the character is not supported by the character set - Throws:
UnsupportedEncodingException- if thedbCharsetparameter is invalid
-
synchronizeLocale
public static boolean synchronizeLocale(Locale locale, Connection con) throws SQLException
Synchronizes the session NLS parameters with the locale.This executes
ALTER SESSIONSQL commands to set NLS session parameters to synchronize the locale and attributes in this object. The following session parameters are updated:- NLS_LANGUAGE
- NLS_TERRITORY
- Parameters:
locale- Java locale objectcon- database connection- Returns:
trueif successful, otherwisefalse- Throws:
SQLException- if a SQL exception occurs
-
synchronizeLocale
public static boolean synchronizeLocale(String oralanguage, String oraterritory, Connection con) throws SQLException
Synchronizes the database session NLS parameters with the Oracle language and territory names.This executes
ALTER SESSIONSQL commands to set NLS session parameters to synchronize the locale and attributes in this object. The following session parameters are updated:- NLS_LANGUAGE
- NLS_TERRITORY
- Parameters:
oralanguage- Oracle language nameoraterritory- Oracle territory namecon- database connection- Returns:
trueif successful, otherwisefalse- Throws:
SQLException- if a SQL exception occurs
-
-