NHibernate & ORA-12571

26 Jun

When I was querying against Oracle database using NHibernate, I ran into Nhibernate.Exceptions.GenericADOException:{“could not update: … The InnerException of it was ORA-12571: TNS:packet writer failure. Resources on the net state that ORA-12571 happens generally when there is a network failure. But in my case it always happens on certain querys. Queries without string type parameters work normally. Turns out it is a Unicode to ASCII conversion problem. Adding a type attribute for string properties in the mapping file as follow can solve it:

<property name="SomePropertyName"  type="AnsiString" ></property>

The exception message is really misleading.


NHibernate and The Case of the Crappy Oracle Error Message

NHibernate and ORA-12571 Errors

Failed to UPDATE or INSERT using NHibernate

Leave a comment

Posted by on June 26, 2012 in .NET, NHibernate, ORM


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: