Revision 1217
Added by Jing Tao almost 22 years ago
DocumentIdentifier.java | ||
---|---|---|
124 | 124 |
*/ |
125 | 125 |
private String getNewestRev() throws SQLException, ClassNotFoundException |
126 | 126 |
{ |
127 |
PreparedStatement pstmt; |
|
128 |
Connection conn = null; |
|
127 |
PreparedStatement pstmt = null; |
|
128 |
DBConnection dbConn = null; |
|
129 |
int serialNumber = -1; |
|
129 | 130 |
|
130 | 131 |
try { |
131 |
try { |
|
132 |
/*try {
|
|
132 | 133 |
//this connection is prone to error for some reason so we |
133 | 134 |
//try to connect it three times before quiting. |
134 | 135 |
conn = util.openDBConnection(); |
... | ... | |
144 | 145 |
sqleee.getMessage()); |
145 | 146 |
} |
146 | 147 |
} |
147 |
} |
|
148 |
|
|
149 |
pstmt = conn.prepareStatement("select rev from xml_documents where " + |
|
148 |
}*/ |
|
149 |
dbConn=DBConnectionPool. |
|
150 |
getDBConnection("DocumentIdentifier.getNewestRev"); |
|
151 |
serialNumber=dbConn.getCheckOutSerialNumber(); |
|
152 |
pstmt = dbConn.prepareStatement("select rev from xml_documents where " + |
|
150 | 153 |
"docid like '" + docid + "'"); |
151 | 154 |
pstmt.execute(); |
152 | 155 |
ResultSet rs = pstmt.getResultSet(); |
... | ... | |
154 | 157 |
if (tablehasrows) { |
155 | 158 |
String retStr = rs.getString(1); |
156 | 159 |
pstmt.close(); |
157 |
conn.close(); |
|
160 |
//conn.close();
|
|
158 | 161 |
return retStr; |
159 | 162 |
} |
160 |
conn.close(); |
|
163 |
//conn.close();
|
|
161 | 164 |
} catch(SQLException e) { |
162 | 165 |
System.out.println("error in DocumentIdentifier.getNewestRev(): " + |
163 | 166 |
e.getMessage()); |
164 |
try { |
|
165 |
conn.close();
|
|
166 |
} catch(SQLException e2) { throw e2; } |
|
167 |
/*try {
|
|
168 |
conn.close(); |
|
169 |
} catch(SQLException e2) { throw e2; }*/
|
|
167 | 170 |
throw e; |
168 | 171 |
} |
172 |
finally |
|
173 |
{ |
|
174 |
try |
|
175 |
{ |
|
176 |
pstmt.close(); |
|
177 |
}//try |
|
178 |
finally |
|
179 |
{ |
|
180 |
DBConnectionPool.returnDBConnection(dbConn,serialNumber); |
|
181 |
}//finally |
|
182 |
}//finally |
|
183 |
|
|
169 | 184 |
|
185 |
|
|
170 | 186 |
return "1"; |
171 | 187 |
} |
172 | 188 |
|
Also available in: Unified diff
Merge DBConnection branch to head.