Advertisement
Advertisement
| 05.08.2008 at 08:35AM PDT, ID: 23386466 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: |
public class DataConnector {
private Connection connect = null;
public DataConnector() throws Exception {
try {
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("myhost", "myusername", "mypassword");
connect.setAutoCommit(false);
}
catch(Exception e) {
throw e;
}
}
private Statement getStatement() {
Statement s = null;
while (s == null) {
try {
s = connect.createStatement();
} catch (Exception e) {
try {
wait(200);
} catch (Exception xx) {}
}
}
return (s);
}
public void closeConnection() throws Exception {
try {
connect.close();
}
catch(Exception ex) {
throw ex;
}
}
}
|