gregorydony@gmail.com

Problem opening a connection to an Oracle database with Password in connection String

Discussion created by gregorydony@gmail.com on Mar 26, 2011
Latest reply on Mar 27, 2011 by gregorydony@gmail.com
Hi,

Using ArcObject CSharp ArcMap 10.

I try to add a table (Oracle 9) to ArcMap for accessing attribute data (in plan to join it with a personal geodatabase).

For opening the connection to database I use the OLEDBWorkspaceFactoryClass like this :

IPropertySet propertySet = new PropertySetClass();
propertySet.SetProperty("CONNECTSTRING", connexionString);

Type factoryType = Type.GetTypeFromProgID("esriDataSourceOleDB.OLEDBWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory) Activator.CreateInstance(factoryType);

IWorkspace workspace = workspaceFactory.Open(propertySet, 0);


When I don't put the password in the connection String:

String connectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=user;Data Source=source";


it works fine except of course a pop up asking for password.

But when I add the password in the connection String like this:

String connectionString = "Provider=MSDASQL.1;Password=password;Persist Security Info=False;User ID=user;Data Source=source";


I have an error "System.runtime.InteropServices.COMException" without any precision.

I tried also to use other properties like PASSWORD or USER. Tryed alos the method "OpenFromString" from another interface implemented by OLEDBWorkspaceFactoryClass  without any success...

Thank you !

G. Dony
GISObject SPRL
Belgium

Outcomes