Reputation: 1
Oracle Bulk Load takes the schema of the current connection, is there a way to prevent it from doing so? Just in case I can't create such a synonym, I just post. That is to say that when loading the bulk load it does not take any scheme.
public class BulkLoader
{
public static void LoadBulkData(string connectionString, DataTable data, string tableName)
{
ConnectionProvider provider = new ConnectionProvider(connectionString);
using (OracleConnection connection = provider.GetConnection())
{
OracleTransaction transaction = connection.BeginTransaction();
try
{
using (OracleBulkCopy bulkCopy = new OracleBulkCopy(connection))
{
bulkCopy.DestinationTableName = tableName;
foreach (DataColumn column in data.Columns)
{
bulkCopy.ColumnMappings.Add(column.ColumnName, column.ColumnName);
}
bulkCopy.WriteToServer(data);
}
transaction.Commit();
}
catch (Exception ex)
{
transaction.Rollback();
throw new Exception("Se produjo un error durante la carga masiva.", ex);
}
}
}
}
The indicated table is the correct one but it always takes the schema of the current connection something like Schema.Table and should be just Table
Upvotes: -1
Views: 44
Reputation: 11586
Check out the DestinationSchemaName to nominate the target schema.
Upvotes: 0