Changeset 326

Show
Ignore:
Timestamp:
03/04/10 14:32:20 (5 months ago)
Author:
martijn
Message:

Fixed: complains about schemaversion for completely unrelated errors

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/org.bridgedb.rdb/src/org/bridgedb/rdb/SimpleGdbFactory.java

    r318 r326  
    5252                ResultSet r = null; 
    5353                Statement stmt = null; 
    54                 try  
     54                 
     55                try 
    5556                { 
    56                         con = DriverManager.getConnection(connectionString); 
    57                         stmt = con.createStatement(); 
    58                         r = stmt.executeQuery("SELECT schemaversion FROM info"); 
    59                         if(r.next()) version = r.getInt(1); 
    60                 }  
    61                 catch (SQLException e)  
    62                 { 
    63                         //Ignore, older db's don't even have schema version 
     57                        try  
     58                        { 
     59                                con = DriverManager.getConnection(connectionString); 
     60                                stmt = con.createStatement(); 
     61                        }  
     62                        catch (SQLException e)  
     63                        { 
     64                                throw new IDMapperException("Could not connect to database", e); 
     65                        } 
     66                        try  
     67                        { 
     68                                r = stmt.executeQuery("SELECT schemaversion FROM info"); 
     69                                if(r.next()) version = r.getInt(1); 
     70                        }  
     71                        catch (SQLException e)  
     72                        { 
     73                                throw new IDMapperException("Database schema error, info table or schemaversion column missing", e); 
     74                        } 
    6475                } 
    6576                finally 
     
    6980                        if (con != null) try { con.close(); } catch (SQLException ignore) {} 
    7081                } 
    71                  
     82 
    7283                switch (version) 
    7384                {