Ask a Question

Schema in the Connection string to connect to Oracle DB

Adagio
Frequent Contributor

Schema in the Connection string to connect to Oracle DB

Hi,

 

I have a connection string that I use to connect to oracle DB.

I'm not sure if schema name can also be passed in the connection string. I tried and it didn't work.

Is there any other way to do this or any different parameter name I should be using other than 'Current Schema' ?

 

 

   conn.ConnectionString = 
                          "Driver={DriveName};"+
                          "Data Source = XXX;" +   
                          "CurrentSchema  = XXXXX;" +                       
                          "User ID  = XXX;" +
                          "Password = XX" ;

 

Any help would be appreciated!

 

Thank you

Abhi

2 REPLIES 2
cunderw
Community Hero

Unless I am mistaken, schema is set per user at the database level, not by your connection so this isn't something you can do when connecting. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Adagio
Frequent Contributor

Hi @cunderw, I agree with that, but here I have some generic Id that has access to 15 different schemas. Unless there's a way to pass a parameter that tells which schema.table to query on, It's difficult to go to the actual schema.table. 

 

I've used a different way to do this. Instead of passing the schema name in the connection string, I've parameterized schemaname in    'schemaname.table' in the sql queries. that works without any problems but I don't like it very much.

 

However,  for DB2, I can pass the schema names  in the connection string itself.

 

Thank you

Abhi

cancel
Showing results for 
Search instead for 
Did you mean: