tags:

views:

32

answers:

1

The database user has got two schemas. I need to read the data from a specific schema using ado.net. I am using OleDbConnection object to create the connection to database. Appreciate your answers.

+3  A: 

Hi Preetham,

Use SCHEMA_NAME.TABLE_NAME in your queries.

If you don't specify a schema, Oracle will look into the current schema. The schema is by default the connexion user (so if you connect with USER1 and query TABLE1, Oracle will look for the table USER1.TABLE1). You can change your current schema at any time during a session with:

ALTER SESSION SET CURRENT_SCHEMA=SCHEMA2;

You can also use synonyms to point to the correct table.

Vincent Malgrat
Thanks for your quick reply. Is there any other options exist to set the schema name in the connection/command/adapter object? This will avoid burden of appending schema name in all queries.
Preetham
@Preetham: I updated my answer => either change the current_schema, change the connexion user or use synonyms
Vincent Malgrat
Hi Vincent,Thanks for the suggestion. This might be helpful,let me try..:)
Preetham