private void queryDatabaseMetaData()
   {
      ResultSet rs = null;

      try
      {
         Set<String> tables = new HashSet<String>();
         DatabaseMetaData dmd = m_connection.getMetaData();
         rs = dmd.getTables(null, null, null, null);
         while (rs.next())
         {
            tables.add(rs.getString("TABLE_NAME"));
         }

         m_hasResourceBaselines = tables.contains("MSP_RESOURCE_BASELINES");
         m_hasTaskBaselines = tables.contains("MSP_TASK_BASELINES");
         m_hasAssignmentBaselines = tables.contains("MSP_ASSIGNMENT_BASELINES");
      }

      catch (Exception ex)
      {
         // Ignore errors when reading meta data
      }

      finally
      {
         if (rs != null)
         {
            try
            {
               rs.close();
            }

            catch (SQLException ex)
            {
               // Ignore errors when closing result set
            }
            rs = null;
         }
      }
   }
private void queryDatabaseMetaData ( ) { ResultSet rs = null ; try { Set < String > tables = new HashSet < String > ( ) ; DatabaseMetaData dmd = m_connection . getMetaData ( ) ; rs = dmd . getTables ( null , null , null , null ) ; while ( rs . next ( ) ) { tables . add ( rs . getString ( "TABLE_NAME" ) ) ; } m_hasResourceBaselines = tables . contains ( "MSP_RESOURCE_BASELINES" ) ; m_hasTaskBaselines = tables . contains ( "MSP_TASK_BASELINES" ) ; m_hasAssignmentBaselines = tables . contains ( "MSP_ASSIGNMENT_BASELINES" ) ; } catch ( Exception ex ) { } finally { if ( rs != null ) { try { rs . close ( ) ; } catch ( SQLException ex ) { } rs = null ; } } }
Queries database meta data to check for the existence of
specific tables.