I'm using Oracle.ManagedDataAccess
for running my application, basically I tested out the sql in SQL Developer
and now want to port that over to .NET.
Let's say I have a user which has all the rights to query from a different schema.
SELECT * FROM "SCHEMA"."TABLE"
SELECT * FROM schema.table
Are all working in Sql Developer with the exact same user but I get table or view not exists from .NET.
I also tried setting the current schema with:
ALTER SESSION SET CURRENT_SCHEMA = schema
The alter session works because when I try with that and specify the table name without schema it says that table or view from schema.table
doesn't exists.
I kind of tried out everything my connection string looks the following:
User Id=other_user; Password=; Data Source=IP:PORT/SERVICENAME;
UPDATE Code Snippet from C#
using (OracleConnection connection = new(_connectionString))
{
await connection.OpenAsync(cancellationToken);
OracleGlobalization info = connection.GetSessionInfo();
var sql2 = @"SELECT * FROM ""schema"".""table""";
using (OracleCommand cmd = new OracleCommand(sql2, connection))
{
cmd.ExecuteNonQuery();
}
}
And that throws the exception of table or view doesn't exists.
At the end I was able to figure out the problem with the help of one of the comments.
So basically what I did I checked the ALL_TABLES
in both Sql Developer and with the code, it was obviously visible that my schema tables wasn't there in the .NET Version.
Then I started over the whole thing, starting from the connection strings and everything and it turned out that:
So basically I indeed connected to a different DB.