Select to view content in your preferred language

Connect from ArcObjects 10.1 Java (1.5) to ArcSDE (10.1) + PostgreSQL (9.0.5)

1473
6
10-03-2012 01:43 AM
MarcosRodriguez_Gómez
Deactivated User
Hi.

I'm developing a Java main app with ArcObjects 10.1, when I run this app and it tries to connecto to ArcSDE 10.1 (over PostgreSQL 9.0.5) I get the following error:

AutomationException: 0x8004156b -
at com.esri.arcgis.datasourcesGDB.SdeWorkspaceFactory.open(Unknown Source)
at es.edb.prueba.conexiones.ConexionSDE.conectar(ConexionSDE.java:52)
at es.edb.prueba.principal.PruebaAO.main(PruebaAO.java:50)

If I change the PropertySet with ArcSDE 9.3.1 + Oracle 10g connection params it gets success.

What should I do for solving this problem? Should I intall PostgreSQL client in client machine? Where?

Thanks in advance.

My connection code:

...
        public void conectar() {
  
  PropertySet propSet = null;
  
  try {
   
   // Create a WorkspaceFactory object within the Server's context
   gWorkspaceFactory = (SdeWorkspaceFactory) ConexionAGS.crearObjeto(SdeWorkspaceFactory.getClsid());
   
   // Create an instance of a PropertySet for an Oracle ArcSDE connection. 
   // The PropertySet acts as an array of keyed values that ArcSDE will use to collect
   // the connection values from:
   propSet = (PropertySet) ConexionAGS.crearObjeto(PropertySet.getClsid());
   propSet.setProperty("SERVER", "my_server_name");
   propSet.setProperty("INSTANCE", "5151");
   propSet.setProperty("DATABASE", "arcsde");
   propSet.setProperty("USER", "sde");
   propSet.setProperty("PASSWORD", "passwordsde");
   propSet.setProperty("VERSION", "SDE.DEFAULT");
   
   // Open the ArcSDE workspace and get a handle to it through the WorkspaceFactory, 
   // passing in the PropertySet
   gWS = gWorkspaceFactory.open(propSet, 0);
   
   Cleaner.release(propSet);
   // You now have a connection to the database through a Workspace object (gWS).
  
  } catch (Exception e) {
  
   e.printStackTrace();
     
  }
 }
...


Configuration:

Java 1.5
arcobjects.jar 10.1
ArcSDE 10.1
PostgreSQL 9.0.5
Server Operating System: W2003 Server Standard 64 bits
Client Operating System: Windows 7 Professional 64 bits
0 Kudos
6 Replies
MandarPurohit
Esri Contributor
Hi Marcos,

Based on your ArcSDE 9.3.1 + Oracle 10g connection parameters, this is an application server connection or ArcSDE Service (Instance=5151). If a 10.1 geodatabase is already available, you can install application server 10.1 and create a new ArcSDE 10.1 service (and use that instance/port number in your connection).

To begin with PostgreSQL installation and database creation, I believe, the following tutorial would help. It follows all the steps including the connection:

Tutorial: Getting started with geodatabases in PostgreSQL

The last step from this tutorial connects to the database using "Database Connection" window. You can use these parameters in your code.

Regards,
Mandar
0 Kudos
MarcosRodriguez_Gómez
Deactivated User
Hi Mandar.

I have two machines, ArcSDE 9.3.1 + Oracle 10g are installed on a machine and ArcSDE 10.1 + PostgreSQL 9.0.5 are installed in other one. I'd like to connect to the two machines from arcobjects 10.1 Java (no ArcCatalog, no ArcMap). My Java app connect to ArcSDE 9.3.1 + Oracle 10g without problem but when I change the connection params to connect to ArcSDE 10.1 I get the following error:

AutomationException: 0x8004156b -
            at com.esri.arcgis.datasourcesGDB.SdeWorkspaceFactory.open(Unknown Source)
            at es.edb.prueba.conexiones.ConexionSDE.conectar(ConexionSDE.java:52)
            at es.edb.prueba.principal.PruebaAO.main(PruebaAO.java:50)


Connection code:

...
        public void conectar() {
  
  PropertySet propSet = null;
  
  try {
   
   // Create a WorkspaceFactory object within the Server's context
   gWorkspaceFactory = (SdeWorkspaceFactory) ConexionAGS.crearObjeto(SdeWorkspaceFactory.getClsid());
   
   // Create an instance of a PropertySet for an Oracle ArcSDE connection. 
   // The PropertySet acts as an array of keyed values that ArcSDE will use to collect
   // the connection values from:
   propSet = (PropertySet) ConexionAGS.crearObjeto(PropertySet.getClsid());
   propSet.setProperty("SERVER", "my_server_name");
   propSet.setProperty("INSTANCE", "5151");
   propSet.setProperty("DATABASE", "arcsde");
   propSet.setProperty("USER", "sde");
   propSet.setProperty("PASSWORD", "passwordsde");
   propSet.setProperty("VERSION", "SDE.DEFAULT");
   
   // Open the ArcSDE workspace and get a handle to it through the WorkspaceFactory, 
   // passing in the PropertySet
   gWS = gWorkspaceFactory.open(propSet, 0);
   
   Cleaner.release(propSet);
   // You now have a connection to the database through a Workspace object (gWS).
  
  } catch (Exception e) {
  
   e.printStackTrace();
     
  }
 }
...


Thanks,
Marcos
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Can command-line utilities and/or Desktop connect to the 10.1 application server with the same parameters?
[Note: This should not in any way be interpreted as encouragement for applications to EVER connect as user
SDE for anything other than instance or versioning management. The 'sde' user password should be closely
held, and never included in source or published on the Internet.]

Do the ArcSDE and/or database error logs have anything useful to say?

- V
0 Kudos
MarcosRodriguez_Gómez
Deactivated User
Yes, I can connect to ArcSDE 10.1 (+ PostgreSQL 9.0.5) from ArcCatalog and ArcMap with the same connections params.

No, ArcSDE logs don´t show anything, the Java app doesn´t connect to ArcSDE, therefore log doesn´t show any information.

Thanks,
Marcos.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
The folks over in ArcObjects - All Development Languages might have more
experience with automation exceptions.

- V
0 Kudos
MarcosRodriguez_Gómez
Deactivated User
Ok, thanks.

I'll post my problem in that forums.

Regards,
Marcos.
0 Kudos