title: Establishing direct connection to ESRI geodatabase on Oracle hangs while not in debug mode
body: <p>Recently I have been trying to establish direct connection to oracle geodatabase using Java API.</p>
  
  <p>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.</p>
  
  <p>Here is a piece of code that I use:</p>
  
  <pre><code>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();  
                  }  
              }  
          }  
      }  
  }  
  </code></pre>
  
  <p>Here is my system configuration:</p>
  
  <p><strong>System:</strong> Windows 7 Professional 64bit</p>
  
  <p><strong>Java:</strong> 8 update 40 64 bit</p>
  
  <p><strong>Oracle client:</strong> Oracle 11g 64bit</p>
  
  <p><strong>ArcSDE SDK:</strong> 10.2.2 64bit</p>
  
  <p>Other settings.</p>
  
  <p><strong>1.</strong> 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:</p>
  
  <p>icudt44.dll</p>
  
  <p>icuuc44.dll</p>
  
  <p>pe.dll</p>
  
  <p>sg.dll</p>
  
  <p>xerces-c_3_1.dll</p>
  
  <p>sde.dll</p>
  
  <p>sdejavautil.dll</p>
  
  <p>gsrvrora11g102.dll</p>
  
  <p>sdeora11gsrvr102.dll</p>
  
  <p><strong>2.</strong> The path to {SDEHOME}/bin is added to the Path of the system.</p>
  
  <p><strong>3.</strong> The path to {SDEHOME}/bin is added to Java VM: -Djava.library.path={absolute-path-to-bin-folder}</p>
  
  <p><strong>4.</strong> The oracle databases are fine, I cann see my spatial data with ArcCatalog.</p>
  
  <p><strong>5.</strong> Here is my TNS definition:</p>
  
  <pre><code>geobase_tns =
  
    (DESCRIPTION =
  
  (ADDRESS_LIST =
  
    (ADDRESS = (PROTOCOL = TCP)(HOST = {my-host-ip})(PORT = {my-port-number}))
  
  )
  
  (CONNECT_DATA =
  
    (SERVICE_NAME = {my-service-name})
  
  )
  </code></pre>
  
  <p>)</p>
  
  <p><strong>6.</strong> Here is my sqlnet.ora file:</p>
  
  <p>SQLNET.AUTHENTICATION_SERVICES= (NONE)</p>
  
  <p>NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)</p>
  
  <p>What I've already tried.</p>
  
  <p><strong>1.</strong> I tried to use other java versions</p>
  
  <p><strong>2.</strong> I tried to add ORACLE_HOME system variable and pointed it to my oracle client installation</p>
  
  <p><strong>3.</strong> I disabled Windows firewall and my antivirus system.</p>
  
  <p><strong>4.</strong> I tried connecting to both 9.3.1 oracle geodatabase and 10.3 oracle geodatabase.</p>
  
  <p>In each case I got the same result: stepping in debug mode is fine, running the application freely - hangs.</p>
  
  <p>At this point I am run out of ideas. I can see in my IDE (eclipse - mars) that it holds at SeConnection.createDirectConnection() method.</p>
  
  <p>Can someone give me some suggestions why it behaves like that ? Maybe I missed something while preparing the system for direct connection.</p>