• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to use NVARCHAR2 in Oracle with WO5.2.3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to use NVARCHAR2 in Oracle with WO5.2.3


  • Subject: How to use NVARCHAR2 in Oracle with WO5.2.3
  • From: Kaj Hejer <email@hidden>
  • Date: Fri, 19 Mar 2004 09:36:14 +0100

Hi!

We have an WO application that need to use tables in an Oracle 8i database that contains NVARCHAR2 columns with UTF-8 encoding.

My question is:

How do we set up EOModeler and the application to use NVARCHAR2 with UTF-8 encoding correct?

To test this I have made the following table:

SQL> desc utftest;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER
TEKST NVARCHAR2(600)



and added the following keys to the eomodel:

databaseEncoding = "UTF-8"
NLS_LANG = "AMERICAN_AMERICA.UTF8"

In Main I have added a textfield to edit the column TEKST in the database.

When saving we get the following oracle errormessage:

ORA-12704: character set mismatch

We got the same errormessage with WO5.2.2.

I have done as described for unicode at <url:http://wodev.spearway.com/cgi-bin/WebObjects/WODev.woa/2/wa/Main?wikiPage=InternationalCharacters>

The full stacktrace and sql-output is as follows:


[2004-03-17 13:43:03 CET] <main> Waiting for requests...
[2004-03-17 13:43:07 CET] <WorkerThread0> com.webobjects.eoaccess.EODatabase@ec0130 added model at path "file:/Users/kajh/src/webobjects/utftest/build/utftest.woa/Contents/Resources/kajh.eomodeld".
[2004-03-17 13:43:07 CET] <WorkerThread0> Using JDBCPlugIn 'com.webobjects.jdbcadaptor.OraclePlugIn' for JDBCAdaptor@16282589
[2004-03-17 13:43:07 CET] <WorkerThread0> connecting with dictionary: {password = "<password deleted for log>"; plugin = ""; username = "kajh"; NLS_LANG = "AMERICAN_AMERICA.UTF8"; driver = ""; databaseEncoding = "UTF-8"; URL = "jdbc:oracle:thin:@xxxx:9999:xxxx"; }
[2004-03-17 13:43:09 CET] <WorkerThread0> === Begin Internal Transaction
[2004-03-17 13:43:09 CET] <WorkerThread0> evaluateExpression: <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "SELECT t0.ID, t0.TEKST FROM UTFTEST t0">
[2004-03-17 13:43:09 CET] <WorkerThread0> 1 row(s) processed
[2004-03-17 13:43:09 CET] <WorkerThread0> === Commit Internal Transaction
[2004-03-17 13:43:25 CET] <WorkerThread0> === Begin Internal Transaction
[2004-03-17 13:43:25 CET] <WorkerThread0> evaluateExpression: <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "SELECT t0.TEKST FROM UTFTEST t0 WHERE t0.ID = ? FOR UPDATE" withBindings: 1:1(id)>
[2004-03-17 13:43:25 CET] <WorkerThread0> 1 row(s) processed
[2004-03-17 13:43:25 CET] <WorkerThread0> evaluateExpression: <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "UPDATE UTFTEST SET TEKST = ? WHERE ID = ?" withBindings: 1:"hi all"(tekst), 2:1(id)>
[2004-03-17 13:43:25 CET] <WorkerThread0> === Rollback Internal Transaction
[2004-03-17 13:43:25 CET] <WorkerThread0> <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request:
com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "UPDATE UTFTEST SET TEKST = ? WHERE ID = ?" withBindings: 1:"hi all"(tekst), 2:1(id)>:
Next exception:SQL State:72000 -- error code: 12704 -- msg: ORA-12704: character set mismatch


[2004-03-17 13:43:25 CET] <WorkerThread0> com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: <com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "UPDATE UTFTEST SET TEKST = ? WHERE ID = ?" withBindings: 1:"hi all"(tekst), 2:1(id)>:
Next exception:SQL State:72000 -- error code: 12704 -- msg: ORA-12704: character set mismatch


at com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextInformationAdded(EODatabaseContext.java:4676)
at com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:6384)
at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:415)
at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3165)
at Main.save(Main.java:22)




We have the following methods in Application.java to set the correct encoding:

public WOResponse dispatchRequest(WORequest theRequest) {
WOResponse result = super.dispatchRequest(theRequest);
if (enableUTFEncoding && "text/html".equals(result.headerForKey("content-type")) ) {
result.setHeader("text/html; charset=UTF-8; encoding=UTF-8", "content-type");
}
return result;
}


    public void appendToResponse(WOResponse aResponse, WOContext aContext) {
        aResponse.setContentEncoding( _NSUtilities.UTF8StringEncoding );
        super.appendToResponse(aResponse, aContext);
    }

public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) {
aRequest.setDefaultFormValueEncoding( _NSUtilities.UTF8StringEncoding );
super.takeValuesFromRequest(aRequest, aContext);




I'm testing this WO5.2.3 on osx 10.3.3 and Oracle 8i (8.1.7.4.0) on solaris.

TIA!


-Kaj :) _______________________________________________ webobjects-dev mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Boolean and 5.2.3 my experience
  • Next by Date: Re: Does This NSLog Readout Mean anything?
  • Previous by thread: entity name conflict with the entities
  • Next by thread: Strange problem in D2J applications after upgrading to 5.2.3
  • Index(es):
    • Date
    • Thread