how to use java connecting to arcsde 10.1( base oracle 11.2g)

5615
15
12-17-2012 02:28 AM
zhangyx
New Contributor
i install oracle 11.2g, then use arcgis gp tool create arcsde geodatabase on oracle 11.2g.    how can i use java to connect to arcsde.

how can i write the fallowing code ?

SeConnection connection = null;
connection = new SeConnection(server, instance, database, user, password);
0 Kudos
15 Replies
VinceAngelo
Esri Esteemed Contributor
This would be a way to connect to ArcSDE, but that would not give you full geodatabase
functionality.

What are you trying to accomplish?  Writing GIS software (and data) from scratch in Java
probably isn't where you want to start.

- V
0 Kudos
LeoDonahue
Regular Contributor

Writing GIS software (and data) from scratch in Java
probably isn't where you want to start.

- V

Hey...  Let's not single out Java for that... it applies to .NET also.:)
0 Kudos
VinceAngelo
Esri Esteemed Contributor
And 'C', and C++, and Python, and, and COBOL, and FORTRAN, and Ada, and PL/1...

But my point was that an ArcSDE connection does not a GIS make.

- V
0 Kudos
LeoDonahue
Regular Contributor
I understood your point, I was just trying to save face with those who already slant against Java.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Sorry, I didn't have time for strategic smilies.

BTW: My last project had me reading shapefiles in Java from scratch, and drifted
into various topological processing functions to detect and correct topology errors
(including correctly handling antemeridian crossing by polygons).  Java has improved
in performance from the mid-to-late 90's (when I last used it), to the point that I
no longer have a slant against it! (But I still don't want to code a GIS from scratch
with it.)

- V
0 Kudos
zhangyx
New Contributor
i use java api for arcsde 10.1

----------------------------------------------------------------------
String server = "10.1.102.171";
String instance = "sde:oracle11g:jinshui";
String database = null;
String user = "sde";
String password = "sde";

SeConnection connection = null; 
StringBuilder featureCollection=new StringBuilder("");
connection = new SeConnection(server, instance, database, user, password);

---------------------------------------------------------------------------------

but it throw an error as fallow.

------------------------------------------------------------------------------------
java.lang.UnsatisfiedLinkError: no sdejavautil in java.library.path
0 Kudos
VinceAngelo
Esri Esteemed Contributor
First off, you shouldn't ever connect to an ArcSDE instance as 'sde' (and you shouldn't
ever use 'sde' as the password).  The 'sde' user should only be used to administer the
ArcSDE installation, and the password should be closely held to prevent damage to the
database instance.  Instead you should create additional tablespaces and users to own
and access the data loaded into those tablespaces.

You also shouldn't start using the ArcSDE API with a Direct Connect in Java.  Start with
an application service connection, so you can be sure your class path is correct to find
the ArcSDE jarfiles, then you can move on to the arcane.  If you haven't used Java
before, you should spend several weeks working on language basics before attempting
to use a third party API.

Using either of the ArcSDE APIs is an advanced skill, which is much easier to do after
you've been using an instance with ArcGIS for 6-8 months.  The learning curve on the
lightly documented ArcSDE API is rather brutal -- expect it to take 3-6 weeks to learn
how to do anything useful (anything that's going to involve a "featureCollection").
Starting with an empty database is the most difficult way to learn the API -- the start-up
cost increases to 3-6 months if you're going to try to create data from scratch.

- V
0 Kudos
DavidDoss
New Contributor
Hi Vince,

I'm facing the same issue when I run the Java program from Linux environment to Arc SDe 10.1. The same code works fine If I run from UNix (Solaris) environment to Arc SDE9.3  or to ArcSDe 10.1 from RAD setup in PC. Purpose of my program is to access a point layer and make deletions based on certain criteria.

I'm using jpe_sdk.jar, icu4j_3_2.jar, jsde_sdk.jar & concurrent.jar. from Arc SDE 9.3. Is there a different set of Jars that I should use for Arc SDE 10.1 ?  Below is the error I get.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no sdejavautil in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1028)
        at com.esri.sde.sdk.client.JGsrvr.<clinit>(Unknown Source)
        at com.esri.sde.sdk.client.SeConnection.x(Unknown Source)
        at com.esri.sde.sdk.client.SeConnection.<init>(Unknown Source)
  ......
The code I use is
SeConnection conn=null;
conn = new SeConnection(dbServer, dbPort, null, dbUser, dbPass);
return true;
0 Kudos
VinceAngelo
Esri Esteemed Contributor
You cannot connect to a 10.1 instance with a 9.3 client. In fact, 9.3 entered
"Retired" support status with the new year.

Esri stopped shipping C/Java API media with the rest of ArcGIS at 10.0.  You'd
need to contact Customer Service (or the local distributor equivalent) to get
the SDK media for 10.0-10.2.

The ArcSDE Java API is also now deprecated, and will not exist after 10.2.x.
Given that most databases support some form native geometry, I'd think you
could use straight JDBC for this task.

- V
0 Kudos