Advertisement
Advertisement
| 09.19.2008 at 12:57AM PDT, ID: 23745164 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
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: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: |
private String[] siteNames = {
"Please select a site", "localhost", "ALL","AALBORG","AARHUS","VEJLE" ...
};
siteList.setModel(new javax.swing.DefaultComboBoxModel(siteNames));
private void siteListActionPerformed(java.awt.event.ActionEvent evt) {
location = siteList.getSelectedItem().toString();
siteList.setSelectedIndex(0);
ConnectionStatusField.setText("No Connection");
if (location.equalsIgnoreCase("AALBORG")) {
processSiteInfo("111.111.111.111", "root", "", "pizza");
} else if (location.equalsIgnoreCase("ALL")) {
runAll();
} else if (location.equalsIgnoreCase("localhost")) {
processSiteInfo("localhost", "root", "", "pizza");
} else if (location.equalsIgnoreCase("AARHUS")) {
processSiteInfo("111.111.111.112", "msys", "msys", "msys");
}
...}
public void processSiteInfo(String ip, String userName, String pass, String DB_Name) {
try {
url = "jdbc:mysql://" + ip + "/" + DB_Name + "?user=" + userName + "&password=" + pass;
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, userName, pass);
Statement stmt = con.createStatement();
String query = "select This,That,And,The,Other from " + DB_Name + ".syslog where This='XXX' and That='YYYY' and (The='ZZZZ' or The='') order by Other DESC";
ResultSet rs = stmt.executeQuery(query);
ResultsModel model = new ResultsModel(rs);
if (model.getRowCount() > 0) {
jTable1.setModel(model);
siteList.setSelectedIndex(0);
} else {
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object[][]{
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String[]{
"No Data", "For", "This", "Site"
}));
}
rs.close();
stmt.close();
con.close();
} catch (Exception exc) {
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object[][]{
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String[]{
"Connection Error", "For", "This", "Site"
}));
}
}
|