Open Source RDBMS - Seamless, Scalable, Stable and Free

English | Login |Register

Writing CLOB Values to a Data Source

You can write a character large object (CLOB) to a database as  character data, depending on the type of field at your data source. To write a CLOB value to your database, issue the appropriate INSERT or UPDATE statement and pass the CLOB value as an input parameter.

The following code example adds employee information to the Employees table in the DEMODB database. A resume of the employee is read from a file and added to the resume field in the table.


You need to using CREATE TABLE statement to create a table, the table name is Employees. The SQL statement:

create table Employees(resume CLOB, id int);


using CUBRID.Data.CUBRIDClient;
 namespace BLOBExample
     class Program
         static void Main(string[] args)
             CUBRIDConnectionStringBuilder sb = new CUBRIDConnectionStringBuilder("localhost", "demodb", "public", "", "33000", true);
             using (CUBRIDConnection conn = new CUBRIDConnection(sb.GetConnectionString()))
                 string sql = "insert into Employees(resume) values(?)";
                 using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn))
                     StreamReader _reader = new StreamReader(File.Open(@".\John.txt", FileMode.Open));
                     string _resume = _reader.ReadToEnd();

                     CUBRIDBlob Blob = new CUBRIDBlob(conn);
                     Clob.setString(1, _resume);

                     CUBRIDParameter param = new CUBRIDParameter();
                     param.ParameterName = "?";
                     param.CUBRIDDataType = CUBRIDDataType.CCI_U_TYPE_CLOB;
                     param.Value = Blob;


comments powered by Disqus
문서 정보
viewed 689 times
번역 en
posted 작년
마지막 수정시간 작년
변경 내역 보기
Share this article