Thứ Tư, 23 tháng 12, 2009

“ORA-01461: can bind a LONG value only for insert into a LONG column” error in NHibernate

“ORA-01461: can bind a LONG value only for insert into a LONG column” happen when try to insert large text (> 4000 Unicode characters) using NHibernate and Oracle.

Following are steps work around to fix the problem:

1. Using Clob or NClob data type

Normally we use VARCHAR2 or NVARCHAR2 for text. But the max length of these data type is 4000. So If we want to store large text which greater than 4000 characters, we must change the data type to CLOB or NCLOB (for Unicode)

2. Using correct connection.driver_class: NHibernate.Driver.OracleDataClientDriver

We were using the NHibernate.Driver.OracleClientDriver which default to Microsoft's Oracle provider (System.Data.OracleClient). We must change the driver_class property to NHibernate.Driver.OracleDataClientDriver

//c.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.OracleClientDriver");
c.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.OracleDataClientDriver");             



 



Or in config file






<property name="connection.driver_class">
        NHibernate.Driver.OracleDataClientDriver
</property>



 



3. Using correct Mapping attributes: type=”AnsiString”


Normally we can use type=”String” default for CLOB/NCLOB. Try to use type=”AnsiString” if two steps above not work.

<property name="SoNhaDuongPho" column="SO_NHA_DUONG_PHO" type="AnsiString"/>


With three steps above, I solved the problem. Hope this help!



Here are some helpful links



http://msarchitectureadventures.blogspot.com/2009/10/problem-inserting-large-characters.html



http://rextang.net/blogs/past/archive/2005/11/16/2905.aspx



http://nhjira.koah.net/browse/NH-465

Thứ Năm, 10 tháng 12, 2009

Không còn nỗi lo tiếng Việt đối với người dùng SharePoint 2007

Phiên bản SharePoint 2007 đã có bản Language Pack hỗ trợ tiếng Việt từ ngày 20/07/2009. Người dùng Việt Nam chưa cài đặt bản ngôn ngữ tiếng Việt cho SharePoint có thể tải về tại địa chỉ

SharePoint Server 2007 Language Pack  (X86) http://www.microsoft.com/downloads/details.aspx?displaylang=vi&FamilyID=430dabac-146e-4c8b-9338-37569ad373d2

SharePoint Server 2007 Language Pack  (X64) http://www.microsoft.com/downloads/details.aspx?displaylang=vi&FamilyID=0c498ce5-47c2-47ad-9ae7-5a2cd2a81fc7

Windows SharePoint Services 3.0 Language Pack  http://www.microsoft.com/downloads/details.aspx?displaylang=vi&FamilyID=36ee1bf0-652c-4e38-b247-f29b3eefa048

Windows SharePoint Services 3.0 Language Pack (X64) http://www.microsoft.com/downloads/details.aspx?displaylang=vi&FamilyID=45fa2637-efc0-4ed6-8f47-8a013e9ce9d9

Gói ngôn ngữ tiếng Việt thật sự hữu ích đối với sự phát triển của SharePoint tại Việt Nam, càng mang lại ấn tượng tốt đối với người dùng về sản phẩm này.

Hy vọng phiên bản SharePoint 2010 tới có bản language pack cho tiếng Việt đi kèm luôn trong ngày ra mắt để người dùng SharePoint ở Việt Nam khỏi phải mong mỏi lâu