Quantcast
Channel: Question and Answer » oracle
Viewing all articles
Browse latest Browse all 717

ArcObjects / Oracle12c / EZCONNECT

$
0
0

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/

EDIT – No errors are thrown, this .NET add-in just shuts down ArcMap with no warning or error. Not having luck debugging in VS2012 either.

UPDATE – 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.

/// 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@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);

Viewing all articles
Browse latest Browse all 717

Trending Articles