Posts Tagged ‘Oracle’

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: , , , , ,

Managing connections with Oracle or any other Database

March 27th, 2011 1 comment

In case that we have small number of clients that contributes data from Database (our desktop application is classical example where we have exact number of clients known during deployment stage), dilemma is to close or leave database connections open permanently during our Application life time. It’s very important to make right decision at design stage.

Additional aspect that we need to consider of – its Multithreaded environment can cause


from Oracle, we have experienced this problem when the same open connection is used from different threads simultaneously.

Following C# code demonstrate simple example of connection usage.

using (DALFunctions  dal = new DALFunctions())




Read more…

Categories: SQL 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: , , ,

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: , ,