Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

c# managed driver 19.11.0 crashes database with GML string during bulkcopy

Rene W.May 19 2021

I'm experiencing problems with the managed driver when bulk uploading data into a table.
Trying to reproduce the problem with a smaller piece of code gives me a slightly different error but it seems there is data related problem.
To reproduce:
create table clobtest(id number(12,0),clobdata clob)
Create a c# project and include the oracle.managed.driver 19.11.0 package.
using Oracle.ManagedDataAccess.Client;
using System.Data;
using System.IO;

namespace managedclob
{
class Program
{
static void Main(string[] args)
{
DataTable dt = new DataTable();
dt.Columns.Add("ID").DataType = typeof(long);
dt.Columns.Add("CLOBDATA").DataType = typeof(string);

       // create a string of any length  
       // new string('\*', 32767);  
       // or read the file contents  
       string clob = File.ReadAllText(@"c:\\data\\gml.txt");  

       DataRow dr = dt.NewRow();  
       dr\["ID"\] = 2;  
       dr\["CLOBDATA"\] = clob;  
       dt.Rows.Add(dr);  

       OracleConnectionStringBuilder ocsb = new OracleConnectionStringBuilder  
       {  
           Password = "ngm",  
           UserID = "ngm1",  
           DataSource = "rwe19c"  
       };  

       using (OracleConnection Connectie = new OracleConnection(ocsb.ConnectionString))  
       {  
           Connectie.Open();  
           using (var bulkCopy = new OracleBulkCopy(Connectie, OracleBulkCopyOptions.UseInternalTransaction))  
           {  
               bulkCopy.DestinationTableName = "CLOBTEST";  
               bulkCopy.BulkCopyTimeout = 600;  
               bulkCopy.NotifyAfter = 0;  
               bulkCopy.WriteToServer(dt);  
           }  
       }  
   }  

}
}

Running this code if a string of * at any lenght runs fine. Loading the contents of the file returns an error.
Oracle.ManagedDataAccess.Client.OracleException
HResult=0x80004005
Message=ORA-39776: Fatale fout direct-pad-API bij het laden van tabel NGM1.CLOBTEST
ORA-03137: Onjuist TTC-pakket van client afgewezen: [klaprs_12] [0] [512] [6] [8] [1] [] []
gml.txt (31.99 KB)

Comments
Post Details
Added on May 19 2021
3 comments
380 views