These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Urgent Help - Oracle Varchar Problem
PostPosted: Tue Nov 27, 2007 12:51 am 
Newbie

Joined: Mon Jul 16, 2007 9:35 am
Posts: 17
Hi all,

In my oracle10g database,i have a table of 2 fields, one of Integer and another of varchar(4000).
When i try to insert the data with ADO.NET, it is allowing upto 4000 characters. If i try the same with NHibernate, it is throwing the following ERROR "ORA-01461: can bind a LONG value only for insert into a LONG column ". If i enter Lessthan 2000 characters, there is no issue, when word count crosses 2000 , i am facing this ERROR.

My concern is, if it is any error with Oracle Driver or Database, it should not have allowed even with ADO.NET or PL/SQL window, why it is throwing error only when i am using NHibernate.


Could any one try to insert STRING in the Oracle10g database via Nhibernate morethan 2000 and let me know the reason.
It is very critical issue, any suggestion/thoughts would do a great help.

Thanks in advance for your valuable time.

Regards
Sudhagar.S


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 27, 2007 1:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
I don't have an Oracle database to test. However, it sounds like a character encoding issue; that is, over 2000 double-byte characters is the same as over 4000 characters.

There are postings here and there referring to some differences between the Oracle driver and the Microsoft driver. You may want to experiment a bit with a different driver.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 27, 2007 2:08 am 
Newbie

Joined: Mon Jul 16, 2007 9:35 am
Posts: 17
Hi karlchu,

Thanks for your thought.

Well this is configuration details ...

props["hibernate.connection.provider"] = "NHibernate.Connection.DriverConnectionProvider";

props["hibernate.dialect"] = "NHibernate.Dialect.Oracle9Dialect";

props["hibernate.connection.driver_class"] = "NHibernate.Driver.OracleClientDriver";

What do you actually mean of using different drivers? currently i am using Oracle Client Driver, would you point me other available drivers.

Thanks,
Regards
Sudhagar.S


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 27, 2007 11:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
I am really not that familiar with Oracle. You may want to search the forum for "Microsoft Oracle driver". I seem to recall it is an Oracle ADO.NET driver written by Microsoft. Good luck.

_________________
Karl Chu


Top
 Profile  
 
 Post subject: Fixed the Error!!!
PostPosted: Fri Nov 30, 2007 2:01 am 
Newbie

Joined: Mon Jul 16, 2007 9:35 am
Posts: 17
Hi karlchu/sergy/Hibernate Team,

This bug is fixed.
When i debug into the Nhibernate Source, we found the issue in mapping datatype.

This is the mapping HBM attribute:
<property name="PText" type="String">
<column name="PText" length="4000" sql-type="varchar" not-null="false" />
</property>
In the GenericDialect class of NHibernate Source, NHibernate is registering as NVarchar for eqivalent datatype for STRING, even though we pass it as "VARCHAR" Datatype in our HBM file.

Because of this, Varchar has now become NVarchar, as a result
ERROR "ORA-01461: can bind a LONG value only for insert into a LONG column ", we got this ERROR.

In order to fix this, I changed the mapping attribute as follow
<property name="PText" type="AnsiString">
<column name="PText" length="4000" sql-type="varchar" not-null="false" />
</property>


And yes, I was able to fix the above issue.

Thank you all buddies, I hope you will consider this one.

Regards
Sudhagar.S


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.