Changeset 2945
- Timestamp:
- Nov 23, 2006, 12:27:49 PM (16 years ago)
- Location:
- branches/2.1/src/clients/migrate
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.1/src/clients/migrate/net/sf/basedb/clients/migrate/Migrater.java
r2693 r2945 238 238 String user = getProperty("db1.user"); 239 239 String password = getProperty("db1.password"); 240 String url = getProperty("db1.url") ;240 String url = getProperty("db1.url") + "&autoReconnect=true"; 241 241 String driver = getProperty("db1.driver"); 242 242 try -
branches/2.1/src/clients/migrate/net/sf/basedb/clients/migrate/RawBioAssayDataTransfer.java
r2707 r2945 138 138 */ 139 139 cleanUpMemory(); 140 PreparedStatement ps = QUICK_TRANSFER ? prepareStatementFromFile("selectMinimumRawBioAssayData") 141 : prepareStatementFromFile("selectRawBioAssayData"); 142 try 143 { 144 ps.setInt(1, rawBioAssayId); 140 145 141 RawDataBatcher batcher = rawBioAssay.getRawDataBatcher(); 146 142 batcher.setBatchSize(getBatchSize()); 147 runRawBioAssay( ps, 0, getBatchSize(), batcher, hasArrayDesign);143 runRawBioAssay(rawBioAssay, batcher, hasArrayDesign, rawBioAssayId); 148 144 batcher.flush(); 149 145 batcher.close(); 150 }151 catch (SQLException e)152 {153 stop("transferRawBioAssayData", e);154 }155 146 } 156 147 … … 159 150 values from and size. 160 151 161 @param ps <code>PreparedStatement</code> which includes a "LIMIT ?,?" 162 at the end. 163 @param from <code>int</code> indicating start position of the 164 ResultSet. 165 @param size <code>int</code> indicating number of rows to include. 152 @param ps <code>PreparedStatement</code> 166 153 @param batcher RawDataBatcher used in this transfer. 167 154 @param hasArrayDesign (Currently not used) 168 155 @see Transfer#prepareStatementFromFile(String) 169 156 */ 170 protected void runRawBioAssay( PreparedStatement ps, int from, int size,171 RawDataBatcher batcher, boolean hasArrayDesign )157 protected void runRawBioAssay(RawBioAssay rawBioAssay, 158 RawDataBatcher batcher, boolean hasArrayDesign, int base1RawBioAssayId) 172 159 { 173 160 try 174 161 { 175 162 int rowCount = 0; 176 ps.setInt(2, from); 177 ps.setInt(3, size); 178 ResultSet rs = ps.executeQuery(); 163 ResultSet rs = null; 164 Throwable t = null; 165 int numTries = 0; 166 // Fix for unstable BASE 1 server that is randomly losing the connection 167 // For this to work the connection must be created with autoReconnect=true 168 while (rs == null && numTries < 2) 169 { 170 numTries++; 171 try 172 { 173 PreparedStatement ps = QUICK_TRANSFER ? prepareStatementFromFile("selectMinimumRawBioAssayData") 174 : prepareStatementFromFile("selectRawBioAssayData"); 175 ps.setInt(1, base1RawBioAssayId); 176 rs = ps.executeQuery(); 177 t = null; 178 } 179 catch (Throwable t2) 180 { 181 t = t2; 182 log("Exception when loading BASE 1 data for raw bioassay: " + rawBioAssay, t2); 183 try 184 { 185 Thread.sleep(2000); 186 } 187 catch (InterruptedException ex) 188 {} 189 } 190 } 191 if (rs == null || t != null) throw new BaseException(t); 179 192 DbControl dc = batcher.getDbControl(); 180 193 while (rs.next()) … … 183 196 RawData rd = batcher.newRawData(); 184 197 rd.setReporter(reporterT.getReporterById(dc, rs.getInt(2))); 185 // This is not verified, do block, row and col numbers start at186 // 0 or 1?187 198 rd.setBlock(rs.getInt(3)); 188 199 rd.setColumn(rs.getInt(4)); 189 200 rd.setRow(rs.getInt(5)); 201 rd.setX(rs.getFloat(6)); 202 rd.setY(rs.getFloat(7)); 190 203 if (!QUICK_TRANSFER) 191 204 { … … 213 226 progress.increase(); 214 227 } 215 if (rowCount == size)216 {217 // Fetch next batch218 runRawBioAssay(ps, from + size, size, batcher, hasArrayDesign);219 }220 228 } 221 229 catch (SQLException e) -
branches/2.1/src/clients/migrate/sql/mysql-migration-queries.sql
r2693 r2945 971 971 `flags` 972 972 FROM `RawBioAssayData` 973 WHERE `rawBioAssay` = ? 974 ORDER BY `position` 975 LIMIT ?,?; 973 WHERE `rawBioAssay` = ?; 976 974 977 975 … … 979 977 SELECT `element`, `reporter`, `block`, `numCol`, `numRow`, `x`, `y` 980 978 FROM `RawBioAssayData` 981 WHERE `rawBioAssay` = ? 982 ORDER BY `position` 983 LIMIT ?,?; 979 WHERE `rawBioAssay` = ?; 984 980 985 981
Note: See TracChangeset
for help on using the changeset viewer.