Hello,
recently I have been trying to establish direct connection to oracle geodatabase using Java API.
The problem is, that when I execute the code, the connection works fine only in debug mode when I execute the program step by step. In all other cases the program hangs trying to establish the connection.
Here is a piece of code that I use:
public class SdeTest { public static void main(String[] args) { SeConnection connection = null; try { System.out.println("Connecting"); connection = new SeConnection("none", "sde:oracle11g:geobase_tns", "none", "{my-user}", "{my-password}@geobase_tns"); System.out.println("CONNECTION OK"); } catch (SeException e) { e.printStackTrace(); } finally { if(connection != null) { try { connection.freeAllLocks(); connection.close(); } catch (SeException e) { e.printStackTrace(); } } } } }
Here is my system configuration:
System: Windows 7 Professional 64bit
Java: 8 update 40 64 bit
Oracle client: Oracle 11g 64bit
ArcSDE SDK: 10.2.2 64bit
Other settings.
1. I have created SDEHOME system variable and its value points to a folder on the disk. Inside the folder I created 'bin' directory and filled it with the following files:
icudt44.dll
icuuc44.dll
pe.dll
sg.dll
xerces-c_3_1.dll
sde.dll
sdejavautil.dll
gsrvrora11g102.dll
sdeora11gsrvr102.dll
2. The path to {SDEHOME}/bin is added to the Path of the system.
3. The path to {SDEHOME}/bin is added to Java VM: -Djava.library.path={absolute-path-to-bin-folder}
4. The oracle databases are fine, I cann see my spatial data with ArcCatalog.
5. Here is my TNS definition:
geobase_tns =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = {my-host-ip})(PORT = {my-port-number}))
)
(CONNECT_DATA =
(SERVICE_NAME = {my-service-name})
)
)
6. Here is my sqlnet.ora file:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
What I've already tried.
1. I tried to use other java versions
2. I tried to add ORACLE_HOME system variable and pointed it to my oracle client installation
3. I disabled Windows firewall and my antivirus system.
4. I tried connecting to both 9.3.1 oracle geodatabase and 10.3 oracle geodatabase.
In each case I got the same result: stepping in debug mode is fine, running the application freely - hangs.
At this point I am run out of ideas. I can see in my IDE (eclipse - mars) that it holds at SeConnection.createDirectConnection() method.
Can someone give me some suggestions why it behaves like that ? Maybe I missed something while preparing the system for direct connection.
Any 'other' ideas ???
Really ? No ideas what might be wrong ?
I have same issue with Postgres. Very frustrating as it seems to work sometimes. No exception, just hangs. We need a fix.
Thanks