Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | 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
Page info
viewed 1752 times
translations en
posted 4 years ago by
updated 4 years ago by
View revisions
Share this article