当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
Oracle中Clob类型处理解析(二)
发布时间:2010/10/27 16:38:27 来源:www.xue.net 编辑:城市总裁吧

    情况分析:

    为什么要写这种方式,因为这种方式和采用NHibernate的方式很相似,先看看在这种方式会产生什么情况。当data的字节数在0-2000之间时正常插入,大于4000时也正常插入,但在2000-4000时则失败,报错(ORA-01461:仅可以插入 LONG列的LONG值赋值)

    原因分析:

    没有采用对应的Oracle类型。

    解决办法:

    采用OracleType.Clob

    下边采用NHibernate插入数据,NHibernate具体怎用不在本次讨论范围。

    NHibernate采用的版本为1.2.1.4000。

    下边大至把简要配置写下。

    App.config

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

    <configSections>

    <section name="nhibernate" type="System.Configuration.NamueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />

    </configSections>

    <nhibernate>

    <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />

    <add key="hibernate.connection.driver_class" value="NHibernate.Driver.OracleClientDriver" />

    <add key="hibernate.connection.isolation" value="ReadCommitted"/>

    <add key="hibernate.dialect" value="NHibernate.Dialect.Oracle9Dialect" />

    <add key="hibernate.connection.connection_string"

    value="Data Source=Orcl_192.168.0.232;User ID =icqs_test;Password=icqs_test" />

    <add key="show_sql" value="true" />

    <add

    key="hibernate.adonet.batch_size"

    value="100"

    />

    </nhibernate>

    </configuration>

    xx.cs

    using System;

    using System.Collections.Generic;

    using System.Text;

    namespace Test.Enties

    {

    [Serializable]

    public class Xx

    {

    public Xx()

    {

    }

    private string id;

    public virtual string Id

    {

    get { return id; }

    set { id = value; }

    }

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved