title: How to inspect Derby lock with SYSCS_DIAG.LOCK_TABLE (table always showing as empty)?
body: <p>I'm trying to debug an issue with a Derby deadlock under Glassfish (EJB app).  I want to view the lock table at various points so I wrote the following code.  The problem is every where I place a call to it, the lock table is always coming back as empty.  What am I missing?</p>
  
  <pre><code>private void dumpLockTable()
  {
      try ( Connection connection = dataSource.getConnection() )
      {
          PreparedStatement ps = connection.prepareStatement( "SELECT * FROM SYSCS_DIAG.LOCK_TABLE" );
          ResultSet rs = ps.executeQuery();
          ResultSetMetaData rsmd = rs.getMetaData();
          int columns = rsmd.getColumnCount();            
          StringBuilder sb = new StringBuilder();
          sb.append( "Lock Table\n" );
          while( rs.next() )
          {
              for ( int col = 1; col &lt;= columns; col++ )
              {
                  sb.append( rs.getString( col ) );
                  sb.append( "\t|" );
              }
              sb.append( "\n" );
          }
          logger.info( sb.toString() );
      }
  
      catch ( SQLException sqle )
      {
          logger.throwing( LOG_CLASS_NAME, "dumpLockTable", sqle );
      }
  }
  </code></pre>
  
  <p>This is Derby 10.8 under Glassfish 3.1.2.1.  I'm obtaining the DataSource with:</p>
  
  <pre><code>@Resource(mappedName="jdbc/myderbyjndi")
  private DataSource dataSource;
  </code></pre>
  
  <p>All other Derby activity is via entity beans and the entity manager.</p>