Oracle update/insert string conversion

Posts   
 
    
YvesVD
User
Posts: 177
Joined: 19-Oct-2006
# Posted on: 19-Oct-2006 14:02:39   

Using LLBLGen 2.0 with the Oracle MS driver and an Oracle 8i database, we get the following error when updating/inserting an entity using the Microsoft Oracle Driver :

ORA-12704: character set mismatch

After investigation, it appears that when creating the parameters, the original OracleDbType is converted to a DbType within the

SD.LLBLGen.Pro.DQE.Oracle.OracleSpecificCreator.SelectDbType()

method.

                case OracleDbType.Varchar2:
                    return DbType.String;

When the field's OracleDbType is Varchar2, the returned DbType is DbType.String. Further, when the query parameter is created, setting the OracleParameter.DbType property to DbType.String automatically sets the corresponding OracleParameter.OracleDbType to OracleDbType.NVarchar2...confused

I guess this is a bug. The right way should be to set the DbType to AnsiString.

                case OracleDbType.Varchar2:
                    return DbType.AnsiString;

The code is the same for the ODP driver. I is likely that it has to be changed too.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 19-Oct-2006 15:21:27   

Using ODP.NET on 9i, this works fine, this goes wrong when the varchar2 field is defined as single-byte on oracle, so ODP.NET apparently doesn't go wrong in this.

It can't default to ansi-string always , as a string in .NET is 2-byte per char and varchar2 can be 2byte per char as well.

What I can do is to skip SelectDbType and just set the OracleType. ODP.NET had some issues with this and that's why the routine is there (and it always converts oracledbtype to dbtype first).

I'll create a new build of the Oracle DQE for the MS provider and mail it to your email address you used in this forum system for testing.

(edit). This will break apps which use unicoded strings in .NET to save them into 2-byte varchar2 columns using MS Oracle provider (like unicoded varchar2 columns in 9i). However as Microsoft decided to default to single byte ansi strings for varchar2 parameters, it's not something I can solve for everyone.

(edit) Ok, tests run fine here on 9i, I'll mail you the dll to the email address you provided. Please report back that this change indeed solves your problem so we can roll it into the main install.

(edit) mail sent

Frans Bouma | Lead developer LLBLGen Pro
YvesVD
User
Posts: 177
Joined: 19-Oct-2006
# Posted on: 20-Oct-2006 17:43:28   

Sorry, I did not get the mail because it was scratched by our e-mail virus scanner (does not like dlls even in zip files wink - Could you please send it to the following address : yves.vandooren AT skynet.be

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 20-Oct-2006 17:50:54   

Sent! simple_smile

Frans Bouma | Lead developer LLBLGen Pro
YvesVD
User
Posts: 177
Joined: 19-Oct-2006
# Posted on: 23-Oct-2006 15:26:16   

Well received, tested and... successful. Thank you. It seems that we will be able to do a great job with LLblGen pro. sunglasses

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 23-Oct-2006 15:39:12   

Thanks smile

I've closed the issue, it's available in the next build for the people who run into this as well simple_smile

Frans Bouma | Lead developer LLBLGen Pro