WebObjects 5.2: How to Specify the JDBC URL and Choose Database Server Character Encodings

Learn how to specify the correct JDBC URL to connect to a database from a WebObjects application, and see examples of database server encodings that support international characters.
Character encodings can be set at various places in a WebObjects application, such as string encoding for session data, XML encoding, database server encoding, or the encoding used to communicate with the client Web browser. This document only discusses how to specify the correct JDBC URL syntax for a WebObjects application and shows examples of database server encodings to support international characters.

To enter the JDBC URL and connection dictionary:
  1. Start the EOModeler tool.
  2. Select Model, then New to get a new connection panel.
  3. Enter the username and password.
  4. For proper JDBC URL syntax, consult the following table.

Database Name Example Database Server Encoding(s) Example JDBC URL Format WebObjects Default Encoding
Oracle JA16SJIS, Unicode (AL32UTF8) jdbc:oracle:thin:@<SERVERNAME>:1521:<DBNAME> MS932, UTF8
Sybase sjis, utf8 jdbc:sybase:Tds:<SERVERNAME>:11222/<DBNAME> MS932
jdbc:sybase:Tds:<SERVERNAME>:11222/<DBNAME>?CHARSET=utf8&JCONNECT_VERSION=6 UTF8
Microsoft SQL Server 2000 Japanese (cp932) jdbc:microsoft:sqlserver://<SERVERNAME>:1433; DatabaseName=<DBNAME> MS932, UTF8
MySQL Unicode jdbc:mysql://<SERVERNAME>/<DBNAME>?useUnicode=true&characterEncoding=MS932 MS932
jdbc:mysql://<SERVERNAME>/<DBNAME>?useUnicode=true&characterEncoding=UTF8 UTF8
OpenBase SHIFTJIS, Unicode UTF-8, Unicode Extended jdbc:openbase://<SERVERNAME>/<DBNAME> SJIS, UTF8
OpenLDAP Unicode ldap://<SERVERNAME>:389/<dn> UTF8



Notes

1. Database Server Encoding:

Although Unicode or UTF is preferred for its portability, database server encoding tends to be selected by other system requirements or usage patterns. For example, if the database is only used in Japan, then Shift-JIS is probably the better choice. Typically, Japanese database servers are configured using "Shift-JIS" (and its variants such as "MS932"), Japanese EUC, UTF8, and UTF16.

2. WebObjects Default Encoding for Oracle, Sybase, Microsoft SQL Server 2000, MySQL:

If you use "MS 932" as the default encoding, you will be able to use the vendor's Japanese-specific character set. However, using "MS932" is limited to Japanese, while "UTF8" will cover a broad range of characters used in other languages.

See technical document 107667 for setting the browser's character encoding from a WebObjects application.

3. Database Adaptors and JDBC Drivers

For Mac OS X 10.2, Windows 2000, and WebObjects 5.2.1, see the Deploying Applications guide at:

http://developer.apple.com/documentation/WebObjects/Deployment/Deploying_Applications/Installation/chapter_3_section_4.html

Also see technical document 72598 on WebObjects Compatibility.

For Mac OS X 10.3, WebObjects 5.2.2, the following newer database versions and JDBC driver can be used, but they have not been officially qualified by Apple:


4. Additional information

For additional information, consult your JDBC driver documentation.

Oracle 9i
Database encoding supported for Japanese: JA16SJIS, or Unicode
JA16SJIS is Oracle's NLS style specifier for MS 932 and SHIFTJIS. It is usually chosen when the database is only used in Japan.

Sybase
JDBC URL Format: To specify the UTF-8 character set to support international characters, you need to add the CHARSET and JCONNECT_VERSION parameter values.Example:

jdbc:sybase:Tds:localhost:11222/JTest?CHARSET=utf8&JCONNECT_VERSION=6

Microsoft SQL Server 2000
The following data types are not supported in EOModeler or WebObjects applications:
'nchar', 'nvarchar', and 'ntext' data types.

OpenBase: To use vendor specific Japanese characters, select "Unicode UTF-8" or "Unicode Extended" as the database server encoding.

Important: Information about products not manufactured by Apple is provided for information purposes only, and does not constitute Apple's recommendation or endorsement. Please contact the vendor for additional information.

Document 17159, "Locating Vendor Information" can help you search for a particular vendor's address and phone number.
Published Date: Oct 7, 2016