shrug-l: RE: ArcObjects / Oracle12c / EZCONNECT

Pollock, William H. (Bill) William.H.Pollock at dep.state.fl.us
Tue May 5 13:24:34 EDT 2015


Hello again SHRUG -

Well, I think we got it mostly resolved; a misuse of connection properties.
The code snippets below should shed the light.

So can now programmatically pass all of the db connection properties necessary, including the Easy Connect string.
HOWEVER, I still have an issue where the Database Connection dialog appears and must be manually "OK'd" to initiate connection.

The Database Connection dialog was not appearing previously when using the "traditional" connection properties to connect to Oracle11g.
So if you have any thoughts, I am all ears.

Thank you.
+ bill

William Pollock, GISP
Kyra Solutions, Inc.
FL Department of Environmental Protection
850.245.2722 ext. 4722


CODE SNIPPET BEFORE
-------------------
/// Using "traditional" connection properties.
/// Create an SDE connection property set and populate it with connection properties.
IPropertySet propertySet = new PropertySetClass();
propertySet.SetProperty("SERVER", "server");
propertySet.SetProperty("INSTANCE", "instance"); //this is where i was trying to pass the Oracle Easy Connect string
propertySet.SetProperty("DATABASE", "");
propertySet.SetProperty("USER", "user");
propertySet.SetProperty("PASSWORD", "pass");
propertySet.SetProperty("VERSION", "sde.DEFAULT");
/// Open the geodatabase using the property set.
IWorkspace workspace = workspaceFactory.Open(propertySet, 0);

CODE SNIPPET AFTER
-------------------
/// Using Oracle "Easy Connect" connection string.
/// Create a DB connection property set and populate it with connection properties.
IPropertySet propertySet = new PropertySetClass();
propertySet.SetProperty("DATABASE_CONNECTION_PROPERTIES", "user/pass at server:port/service"); //this is the Oracle Easy Connect string
//propertySet.SetProperty("DBCLIENT", "oracle");
//propertySet.SetProperty("USER", "user");
propertySet.SetProperty("PASSWORD", "pass");
/// Open the database using the property set.
IWorkspace workspace = workspaceFactory.Open(propertySet, 0);



From: Pollock, William H. (Bill)
Sent: Tuesday, May 05, 2015 8:37 AM
To: 'shrug-l at lists.dep.state.fl.us'
Subject: ArcObjects / Oracle12c / EZCONNECT

Hello SHRUG -

i am having some trouble connecting to Oracle12c via ArcObjects and EZCONNECT.

Results so far:

*         Can connect via ArcCatalog 10.2.2 using an *.sde file. (EZCONNECT)

*         Can connect via ArcObjects using an *.sde file. (WorkspaceFactory2.OpenFromFile)

*         Cannot connect via ArcObjects using a connection property set. (WorkspaceFactory2.Open)

*         Cannot connect via ArcObjects using a connection string. (WorkspaceFactory2.OpenFromString)

Can someone offer any pointers?

Supporting info:


*         Oracle FAQ on EZCONNECT
http://www.orafaq.com/wiki/EZCONNECT


*         ESRI Blog on Easy Connect
http://blogs.esri.com/esri/supportcenter/2012/10/10/easy-connect-connecting-to-arcsde-just-got-easier/

Thank you.
+ bill

William Pollock, GISP
Kyra Solutions, Inc.
FL Department of Environmental Protection
850.245.2722 ext. 4722

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20150505/1a7774ef/attachment.htm


More information about the SHRUG-L mailing list