We are in need of connecting to the Oracle SDE schema for registering Tables to the sde schema using only ArcObjects(Java) is it possible to do that with no dependency. Assume the geodatabase was created from ArcDesktop tool installed on the WIN OS. However our need is to use ArcObjects Java SDK to connect to the sde schema from Linux OS.
-
You may take a look at this question: gis.stackexchange.com/questions/208073/…– Schuller TomNov 22, 2016 at 7:06
-
There is no need to connect as the SDE user (and, in fact, it violates several best practices). Please edit the question to clarify what you mean by "no dependency", since obviously there is a huge dependency in the form of ArcObjects Java.– VinceNov 22, 2016 at 12:19
1 Answer
There are a couple of ways to connect to the geodatabase and targeting a specific schema using the SDEWorkspaceFactory class. One can build up a PropertySet of the connection properties or provide a path to an existing SDE connection file using the desired credentials. Both of these methods are described in the link provided by Vince above.
SdeWorkspaceFactory workspaceFactory = new SdeWorkspaceFactory();
IWorkspace workspace = workspaceFactory.openFromFile("C:\Path\to\connection_file.sde", 0);
SdeWorkspaceFactory: http://desktop.arcgis.com/en/arcobjects/latest/java/api/arcobjects/com/esri/arcgis/datasourcesGDB/SdeWorkspaceFactory.html
To register spatial tables as feature classes in a geodatabase, one could use the Geoprocessing package and fire off the Register With Geodatabase geoprocessing tool.
String inputConnString = "C:\\Temp\conn_to_gdb.sde";
String fcName = "MySpatialTable";
String featureClassPath = inputConnString + "\\" + fcName;
ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironment();
ISpatialReference srs = srFactory.createGeographicCoordinateSystem(wkid);
GeoProcessor geoProcessor = new GeoProcessor();
VarArray parameters = new VarArray();
parameters.add(featureClassPath);
parameters.add("OBJECTID");
parameters.add("Shape");
parameters.add("POINT");
parameters.add(srs);
geoProcessor.execute("RegisterWithGeodatabase_management", parameters, null);
List of Java ArcObject Geoprocessing Data Management tools: http://desktop.arcgis.com/en/arcobjects/latest/java/api/arcobjects/com/esri/arcgis/geoprocessing/tools/datamanagementtools/package-frame.html
Class RegisterWithGeodatabase http://desktop.arcgis.com/en/arcobjects/latest/java/api/arcobjects/com/esri/arcgis/geoprocessing/tools/datamanagementtools/RegisterWithGeodatabase.html
ArcPy RegisterWithGeodatabase_Management http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/register-with-geodatabase.htm