The bug is not described by your code below.  Read the post carefully.

pseudo code.

IDbParameter parameter = ....
parameter.DbType = DbType.String; //No CLob-NClob equivalent type exists for 
the ado.net DBType
parameter.Value = "new long string..."

OracleClient incorrectly infers the type to be long.  If you tell it what the 
type is as you did below.
 
> cmd.Parameters.Add(":FClob", OracleType.Clob).Value = tmpString;
> cmd.Parameters.Add(":FNClob", OracleType.NClob).Value = tmpString;

then it wont guess and everything will be fine.



-Carlos

 

Practice makes perfect, but if no one is perfect, why practice?




> Date: Tue, 7 Dec 2010 23:22:09 -0800
> Subject: [nhusers] Re: NHibernate 2.1.2 GA + Oracle + clob/nclob = ORA-01461
> From: [email protected]
> To: [email protected]
> 
> > http://thebasilet.blogspot.com/2009/07/nhibernate-oracle-clobs.html
> > ...
> > In reality this is a bug with the microsoft oracle client driver.
> 
> using System.Data.OracleClient;
> ...
> //tmpString = new string('я', 2000);
> //tmpString = new string('я', 2001);
> //tmpString = new string('я', 3000);
> //tmpString = new string('я', 3999);
> //tmpString = new string('я', 4000);
> //tmpString = new string('я', 4001);
> //tmpString = new string('я', 0x0ffff);
> 
> cmd.CommandType = CommandType.Text;
> cmd.CommandText = "update TestTableTypes set FClob = :FClob, FNClob
> = :FNClob";
> cmd.Parameters.Add(":FClob", OracleType.Clob).Value = tmpString;
> cmd.Parameters.Add(":FNClob", OracleType.NClob).Value = tmpString;
> tmpInt=cmd.ExecuteNonQuery();
> 
> works fine.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/nhusers?hl=en.
> 
                                          

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to