Package oracle.i18n.util
Class OraSQLUtil
- java.lang.Object
-
- oracle.i18n.util.OraSQLUtil
-
public class OraSQLUtil extends Object
TheOraSQLUtil
class 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 theUNISTR
function - 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 String
escapeUNISTR(String str, String dbCharset)
Escapes the string intoUNISTR
form if the character is not supported by the database character set.static boolean
isValidIdentifier(String srcstr, String dbCharset)
Checks if the string is valid in the database character set.static boolean
synchronizeLocale(String oralanguage, String oraterritory, Connection con)
Synchronizes the database session NLS parameters with the Oracle language and territory names.static boolean
synchronizeLocale(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:
true
if the data is valid in the database character set, otherwisefalse
- Throws:
UnsupportedEncodingException
- if thedbCharset
parameter is invalid
-
escapeUNISTR
public static String escapeUNISTR(String str, String dbCharset) throws UnsupportedEncodingException
Escapes the string intoUNISTR
form 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
UNISTR
string containing Unicode escaped form if the character is not supported by the character set - Throws:
UnsupportedEncodingException
- if thedbCharset
parameter is invalid
-
synchronizeLocale
public static boolean synchronizeLocale(Locale locale, Connection con) throws SQLException
Synchronizes the session NLS parameters with the locale.This executes
ALTER SESSION
SQL 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:
true
if 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 SESSION
SQL 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:
true
if successful, otherwisefalse
- Throws:
SQLException
- if a SQL exception occurs
-
-