Hello Patrick,

ok, here's my suspicion:
The problem is caused by the field CONTENT NVARCHAR2(1).
You declared it as a unicode field in the database. I think if you used VARCHAR2(1), 
it would work (but you propably had a good reason for chosing NCHAR).
Well, i have no experience with NCHAR and JDBC with OJB (maybe someone else can give a 
more qualified answer).

Here's a testcase that shows the problem from a SQL point of view:

case1
=====
create table test1 (a char(10));
insert into table test1 values('abc');  -> works
insert into table test1 values(N'abc'); -> doesn't work 
                                           (the N'..' tells the server that the string
                                           is in unicaode)

case2
=====
create table test2 (a nchar(10));
insert into table test1 values('abc');  -> doesn't work (i think this is your problem)
insert into table test1 values(N'abc'); -> works (this is what you would like to have)


As far as i understand it:
In java you work with unicode charset, the driver tries to transform this unicode 
values to the charset your database works with (for CHAR fields).In your case this 
transformation takes place, but the the value should be stored in a NCHAR field (where 
no transformation should have happend )

And now:
- i don't know if there is a way to tell ojb to generate the N'...' notation
- there are NLS conversions that the jdbc driver performs automatically,
  do you have the file nls_charset12.zip in your classpath
- if you dont actuelly need the unicode field, change your database to CHAR fields
- maybe you can create your database not with WE8ISO8859P1 or something like that, but 
with
  UNICODE as default characterset for CHAR fields

Sorry, that i don't have the ultimate solution for you, but maybe i helped to fine a 
viable solution.

Regards
Max


> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 23. Oktober 2003 07:57
> An: OJB Users List
> Cc: OJB Users List
> Betreff: Re: AW: Character set mismatch error in Oracle
> 
> 
> 
> 
> 
> 
> 
> Yep, sorry I forgot to include this information here it is:
> 
> <descriptor-repository version="1.0" 
> isolation-level="read-uncommitted">
> <jdbc-connection-descriptor
>       jcd-alias=""
>       default-connection="true"
>       platform="Oracle"
>       jdbc-level="2.0"
>       driver="oracle.jdbc.driver.OracleDriver"
>       protocol="jdbc"
>       subprotocol="oracle:thin"
>       dbalias="@gvo2appd12:1521:EFAX817"
>       username="***"
>       password="***"
>       batch-mode="false"
> >
>   <connection-pool maxActive="21" validationQuery="" />
>   <sequence-manager
> className="org.apache.ojb.broker.util.sequence.SequenceManager
> HighLowImpl">
>     <attribute attribute-name="grabSize" attribute-value="1"/>
>   </sequence-manager>
> </jdbc-connection-descriptor>
> 
> - with which character set did you create your database
> 
> The database was created by our DBA, but he is out for the 
> week :-(  How do
> I check this ?
> 
> - how does the CREATE TABLE statement look like (esp. the 
> datatype in the
> database)
> 
> CREATE TABLE EFAX.MESSAGE
>   (ID INTEGER NOT NULL,
>    CONTENT NVARCHAR2(1) NOT NULL,
>    STATUS INTEGER NOT NULL,
>    CREATION_DATE DATE NOT NULL,
>    MODIFICATION_DATE DATE NOT NULL);
> 
> - (well, and maybe the p6spy output of the actual statement 
> sent to the
> database=
> 
> If only I knew how to use p6spy I would ? Where can I find 
> doc on this tool
> ?
> 
> Thanks and regards,
> 
> Patrick Reyes
> 
> 
>                                                               
>                                                               
>            
>                       "Geigl                                  
>                                                               
>            
>                       Maximilian, R235"        To:       "OJB 
> Users List" <[EMAIL PROTECTED]>                          
>            
>                       <Geigl.Maximilian        cc:       
> (bcc: Patrick Reyes/CDS/CG/CAPITAL)                           
>                 
>                       @akdb.de>                Subject:  AW: 
> Character set mismatch error in Oracle                        
>             
>                                                               
>                                                               
>            
>                       10/22/2003 05:53                        
>                                                               
>            
>                       PM                                      
>                                                               
>            
>                       Please respond to                       
>                                                               
>            
>                       "OJB Users List"                        
>                                                               
>            
>                                                               
>                                                               
>            
>                                                               
>                                                               
>            
> 
> 
> 
> 
> Hi,
> 
> can you tell, which
> - jdbc driver you use (THIN or the one that uses Oracle Net) 
> - maybe the
> connection
>   descriptor wourd be helpful
> - with which character set did you create your database
> - how does the CREATE TABLE statement look like (esp. the 
> datatype in the
> database)
> - (well, and maybe the p6spy output of the actual statement 
> sent to the
> database=
> 
> Max
> 
> > -----Ursprüngliche Nachricht-----
> > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Gesendet: Mittwoch, 22. Oktober 2003 15:38
> > An: [EMAIL PROTECTED]
> > Betreff: Character set mismatch error in Oracle
> >
> >
> >
> >
> >
> >
> > I am trying to access an Oracle 8i DB via OJB.
> >
> > Here is my repository def:
> >
> > <!-- This repository file is generated by the impart OJB 
> Generator -->
> > <!--           www.impart.ch [EMAIL PROTECTED]                 
>        -->
> > <!--        created at 22 Oct 2003 12:37:29 GMT               
> >       -->
> >
> >
> > <!-- Definitions for .EFAX -->
> > <class-descriptor
> >   class="com.capgroup.mo.transport.Message"
> >   table="EFAX.MESSAGE"
> > >
> >   <field-descriptor id="0"
> >     name="id"
> >     column="ID"
> >     jdbc-type="INTEGER"
> >     primarykey="true"
> >   />
> >   <field-descriptor id="1"
> >     name="content"
> >     column="CONTENT"
> >     jdbc-type="VARCHAR"
> >   />
> >   <field-descriptor id="2"
> >     name="status"
> >     column="STATUS"
> >     jdbc-type="INTEGER"
> >   />
> >   <field-descriptor id="3"
> >     name="creation_date"
> >     column="CREATION_DATE"
> >     jdbc-type="DATE"
> >       conversion =
> > "org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDat
> > eFieldConversion"
> >
> >   />
> >   <field-descriptor id="4"
> >     name="modification_date"
> >     column="MODIFICATION_DATE"
> >     jdbc-type="DATE"
> >       conversion =
> > "org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDat
> > eFieldConversion"
> >
> >   />
> >
> > </class-descriptor>
> >
> > And here is my class:
> >
> > // Generated by impart OJB Generator
> > // www.impart.ch [EMAIL PROTECTED]
> > // created at 22 Oct 2003 12:37:30 GMT
> >
> > package com.capgroup.mo.transport;
> >
> > import java.util.Date;
> > //import java.sql.*;
> >
> > public class Message
> > {
> >
> >   private Object content;
> >   private Date creation_date;
> >   private long id;
> >   private Date modification_date;
> >   private long status;
> >
> >
> >
> >   public Object getContent()
> >   {
> >      return this.content;
> >   }
> >   public void setContent(Object param)
> >   {
> >     this.content = param;
> >   }
> >
> >
> >   public Date getCreation_date()
> >   {
> >      return this.creation_date;
> >   }
> >   public void setCreation_date(Date param)
> >   {
> >     this.creation_date = param;
> >   }
> >
> >
> >   public long getId()
> >   {
> >      return this.id;
> >   }
> >   public void setId(long param)
> >   {
> >     this.id = param;
> >   }
> >
> >
> >   public Date getModification_date()
> >   {
> >      return this.modification_date;
> >   }
> >   public void setModification_date(Date param)
> >   {
> >     this.modification_date = param;
> >   }
> >
> >
> >   public long getStatus()
> >   {
> >      return this.status;
> >   }
> >   public void setStatus(long param)
> >   {
> >     this.status = param;
> >   }
> >
> >
> >   public String toString(){
> >     return  " [CONTENT] " + content + " [CREATION_DATE] " +
> > creation_date +
> > " [ID] " + id + " [MODIFICATION_DATE] " + modification_date +
> > " [STATUS] "
> > + status;
> >
> >   }
> > /*  public IValueObject copy(IValueObject vo){
> >     Message tmp = (Message) vo;
> >     if(vo==null) return this;
> >
> >     setContent(tmp.getContent());
> >     setCreation_date(tmp.getCreation_date());
> >     setId(tmp.getId());
> >     setModification_date(tmp.getModification_date());
> >     setStatus(tmp.getStatus());
> >
> >     return this;
> >   }*/
> > }
> >
> > I am getting the following error:
> >
> > SQL:INSERT INTO EFAX.MESSAGE
> > (ID,CONTENT,STATUS,CREATION_DATE,MODIFICATION_DATE) VALUES 
> (?,?,?,?,?)
> > executeInsert: [EMAIL PROTECTED]
> > SQLException during the execution of the insert (for a
> > com.capgroup.mo.transport.Message): ORA-12704: character 
> set mismatch
> >
> > java.sql.SQLException: ORA-12704: character set mismatch
> >
> >       at 
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
> >       at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
> >       at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
> >       at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
> >       at
> > oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleState
> > ment.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatem
> > ent.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleSt
> > atement.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Oracle
> > Statement.java)
> >       at
> > oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(Oracl
> > ePreparedStatement.java)
> >       at
> > 
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Sourc e)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >       at
> > com.capgroup.mo.transport.test.TestMessage.main(TestMessage.java:37)
> > closeResources was called
> > java.sql.SQLException: ORA-12704: character set mismatch
> >       at 
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
> >       at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
> >       at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
> >       at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
> >       at
> > oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleState
> > ment.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatem
> > ent.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleSt
> > atement.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java)
> >       at
> > oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Oracle
> > Statement.java)
> >       at
> > oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(Oracl
> > ePreparedStatement.java)
> >       at
> > 
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >       at
> > com.capgroup.mo.transport.test.TestMessage.main(TestMessage.java:37)
> > rethrown as
> > org.apache.ojb.broker.PersistenceBrokerSQLException: ORA-12704:
> > character set mismatch
> >       at
> > 
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >       at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >       at
> > com.capgroup.mo.transport.test.TestMessage.main(TestMessage.java:37)
> >
> > If someone already had a similar error, I would really 
> appreciate some
> > help,
> >
> > Regards,
> >
> > Patrick Reyes
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to