The summary of this discussion is, while using OracleBulkCopy, even after providing the correct table name and schema name, I get Table or View does not exist error. Below is my code :
public static void WriteToServer(string qualifiedDBName, DataTable dataTable, string schemaName)
{
try
{
using (OracleConnection con = new OracleConnection())
{
con.ConnectionString = Common.ConnectionString;
con.Open();
using (OracleBulkCopy bulkCopy = new OracleBulkCopy(con))
{
bulkCopy.DestinationTableName = schemaName + "." + qualifiedDBName;
bulkCopy.WriteToServer(dataTable);
}
}
}
catch (Exception)
{
throw;
}
}
Surprisingly, this code works in my developement environment, but does not work in UAT. in UAT, if I try to run a query like select * from meri_owner.ati_mapping, where
meri_owner is the schema name and ati_mapping is the
table name, it works properly.
But when I use the same parameters in WriteToServer function(written above), it's not working. Please help, it's urgent.
Regards,
Snigdha
Please Mark as Answer if my reply helped you.
Well after all the searching and getting some help from colleagues, I finally found out the issue. My UAT site was using a user name which did not have insert/update access to the mentioned table. And the table is in another schema, so I had to create a
synonym in the DB user for the schema.table and then use that for updating the value.
Regards,
Snigdha
Please Mark as Answer if my reply helped you.
sargamlucy
Member
559 Points
164 Posts
OracleBulkCopy : table or view does not exist
Nov 16, 2012 10:06 AM|LINK
Hi All,
The summary of this discussion is, while using OracleBulkCopy, even after providing the correct table name and schema name, I get Table or View does not exist error. Below is my code :
public static void WriteToServer(string qualifiedDBName, DataTable dataTable, string schemaName) { try { using (OracleConnection con = new OracleConnection()) { con.ConnectionString = Common.ConnectionString; con.Open(); using (OracleBulkCopy bulkCopy = new OracleBulkCopy(con)) { bulkCopy.DestinationTableName = schemaName + "." + qualifiedDBName; bulkCopy.WriteToServer(dataTable); } } } catch (Exception) { throw; } }Surprisingly, this code works in my developement environment, but does not work in UAT. in UAT, if I try to run a query like select * from meri_owner.ati_mapping, where meri_owner is the schema name and ati_mapping is the table name, it works properly.
But when I use the same parameters in WriteToServer function(written above), it's not working. Please help, it's urgent.
Regards,
Snigdha
Please Mark as Answer if my reply helped you.
sargamlucy
Member
559 Points
164 Posts
Re: OracleBulkCopy : table or view does not exist
Nov 20, 2012 05:39 AM|LINK
Well after all the searching and getting some help from colleagues, I finally found out the issue. My UAT site was using a user name which did not have insert/update access to the mentioned table. And the table is in another schema, so I had to create a synonym in the DB user for the schema.table and then use that for updating the value.
Regards,
Snigdha
Please Mark as Answer if my reply helped you.