예제 #1
0
 /* takes the two experiment ids for which to retrieve data.
  */
 public PairedSQLData(int one, int two) throws SQLException {
   exptone = one;
   expttwo = two;
   try {
     corecxn = DatabaseFactory.getConnection("core");
   } catch (UnknownRoleException ex) {
     throw new DatabaseException("Couldn't connect with role core", ex);
   } catch (SQLException ex) {
     throw new DatabaseException("Couldn't connect to database for role core", ex);
   }
   try {
     chipcxn = DatabaseFactory.getConnection("chipchip");
     basicstmt =
         chipcxn.prepareStatement(
             "select a.channelone, a.channeltwo, a.ratio, b.channelone, b.channeltwo, b.ratio "
                 + " from data a, data b where a.probe = b.probe and a.experiment = ? and "
                 + " b.experiment = ?");
     samplestmt =
         chipcxn.prepareStatement(
             "select * from (select a.channelone, a.channeltwo, a.ratio, b.channelone, b.channeltwo, b.ratio, dbms_random.value as randval "
                 + " from data a, data b where a.probe = b.probe and a.experiment = ? and "
                 + " b.experiment = ? order by dbms_random.value) where randval < ?");
     limitstmt =
         chipcxn.prepareStatement(
             "select aone, atwo, arat, bone, btwo, brat from (select a.channelone aone, a.channeltwo atwo, a.ratio arat, b.channelone bone, b.channeltwo btwo, b.ratio brat "
                 + " from data a, data b where a.probe = b.probe and a.experiment = ? and "
                 + " b.experiment = ? order by dbms_random.value) where rownum < ?");
   } catch (UnknownRoleException ex) {
     throw new DatabaseException("Couldn't connect with role chipchip", ex);
   } catch (SQLException ex) {
     throw new DatabaseException("Couldn't connect to database for role chipchip", ex);
   }
 }
예제 #2
0
 public void close() {
   try {
     basicstmt.close();
     DatabaseFactory.freeConnection(corecxn);
     DatabaseFactory.freeConnection(chipcxn);
     corecxn = null;
     chipcxn = null;
     basicstmt = null;
   } catch (SQLException e) {
     throw new DatabaseException(e.toString(), e);
   }
 }