Posts Tagged ‘Database’

How to do mapping of NCLOB into string in NHibernate

April 11th, 2011 2 comments

I want to describe some error, which is accepted, while mapping NCLOB in NHibernate.

Working with Oracle database, we use “NVARCHAR2” type for strings. But this type has a constrain: it could contain no more then 2000 characters. If one needs to store some long text in Oracle, he will use an NCLOB type.

But, while mapping this type, next error is accepted:
ORA-01461: can bind a LONG value only for insert into a LONG column“.

How can we avoid this error? Two ways are possible:

1) Setting coulumn’s type to “AnsiString”:

        <property name="Contents" column="CONTENTS" type="AnsiString"/> 

Read more…

Categories: .Net, NHibernate Tags: , , , , ,

Pivoting Data in SQL

March 16th, 2011 No comments

I believe that may of you came across the need to pivot, or simply rotate some SQL data from columns to rows, while working with dynamic attributes or key-value pares tables.

For example I have the following database structure:

And of cause each object can have various number of associated attributes. Assuming that I need to fetch all attributes from the relevant objects, while attributes are aligned to the object in the same row, it becomes quite a trivia to perform.

Read more…

Categories: SQL Tags: , , ,

NHibernate configuration, set database connection credentials

March 11th, 2011 No comments

NHibernate configuration, set database connection credentials

Our team started to use NHibernate ORM, it used in part of the components of our Application (Mostly stand alone services).
There are interesting issues bloomed up:
How to use the same DB credentials while you are using NHibernate and standard ADO approach to retrieve, save and update your data. We have plenty Legacy code that cannot move to use NHibernate configuration file. Our main application used standard sql connection string from App.Config file, of cause we doesn’t want to maintain two configuration files.

“hibernate.cfg.xml” file contains basic configuration settings, used by NHibernate; for more detail see … [web site] User Id=;Password=;Data Source=;Pooling=false

Read more…

Categories: .Net, NHibernate Tags: ,

How to remove Oracle client

March 7th, 2011 No comments

In case that regular uninstall wizard is failing from any reason you always may remove client manually – by following this steps.

1. Remove Installation directory c:\Oracle
2. Remove c:\Program Files\Oracle

Reinstall Oracle client again, hopefully your problem with the client will be solved – it worked for me number of times.

Categories: General Tags: , ,