Different Login to same schema same database

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
ChrisWalker
Posts: 10
Joined: Mon 01 Mar 2010 20:17
Contact:

Different Login to same schema same database

Post by ChrisWalker » Tue 02 Mar 2010 14:52

This is my first post and I apologize if I am missing data that is normally posted.

I have two instances of the same schema on a single database on the same IP. So on IP 1.1.1.1 I have a database named DBTEST and I have two different logins 'user1' 'pass1' and 'user2' 'pass2' that login to two different instances of the same schema. Each of these schema's have different data but the same table structure.

I create a model by opening up .connect for Oracle and connecting to the user1 account and pulling a table over to the model. Everythign works fine when I connect with user1/pass1. However when I create an entity connection with user2/pass2 in my connection string and pass it into the constructor of my model, everything seems to work fine, but the data I get back is from the user1/pass1 schema.

If I put in a bad username/opassword in my connection string, I get an exception when calling open on the entity connection so I know the entityconnection is reading the username.

I then deleted my model and recreated another model but initially connected to the user2 schema in .dot connect to pull over the table (instead of the user1 schema I used in my initial model). Now I can only ever connect to the user2 schema and get the user2 data. and cannot get the user1 data.

Note: I did create another database instance on the IP 1.1.1.1 calling it DBTEST2 and put in the user1 and user2 schemas with different data. I had one connection string going to DBTEST and another going to DBTEST2 both with the user1 username. I did get the data from the appropriate database (i.e DBTEST2 instead of DBTEST), they just both automatically go to the user2 schema and I cannot reach the user1 schema.

I'm assuing there is some configuration settng I am missing that tells the model to ignore the username and password in the connection string. Any help?

Connection Stringss
User Id=user1;Password=pass1;Server=1.1.1.1;Direct=True;Sid=DBTEST ;Persist Security Info=False
User Id=user2;Password=pass2;Server=1.1.1.1;Direct=True;Sid=DBTEST ;Persist Security Info=False


EntityConnectionStringBuilder builder = new EntityConnectionStringBuilder();
builder.Provider = "Devart.Data.Oracle";
builder.Metadata = @"res://*/EMR.FacFormularyDataSourceModel.csdl|
res://*/EMR.FacFormularyDataSourceModel.ssdl|
res://*/EMR.FacFormularyDataSourceModel.msl";
builder.ProviderConnectionString = connString;

String ebStr = builder.ToString();

EntityConnection conn = new EntityConnection(ebStr);


conn.Open();
Console.WriteLine("Just testing the connection." + conn.State.ToString());

List drugItems = new List();

DMS.Entities.EMR.FacFormularyDataSourceModel.FacFormularyDataSourceModelEntities _entities =
new DMS.Entities.EMR.FacFormularyDataSourceModel.FacFormularyDataSourceModelEntities(conn);
List formularies =
(from form in _entities.FacilityFormularies where form.FacilityCode == 100).ToList();

...
conn.Close();
Console.WriteLine("Testing after closing connection: " + conn.State.ToString());
[/code]

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 02 Mar 2010 15:52

The problem is in the Schema attribute of the model.
Just open the model using any XML Editor you like and remove the Schema="user1" entry.
This should solve the problem.
If you are using Entity Developer, you are able to change the Schema atrtibute in design time.

ChrisWalker
Posts: 10
Joined: Mon 01 Mar 2010 20:17
Contact:

Post by ChrisWalker » Tue 02 Mar 2010 16:05

Thank You Andrey. That worked.

Post Reply