try {
pa="weblog";
pas="weblog";
Connection c;
Statement st;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c = DriverManager.getConnection("jdbc:odbc:"+pa+"");
st = c.createStatement();
int i=0,j=0;
ResultSet rs = st.executeQuery("select * from "+pas+" where URLstem like ''%gif'' or URLstem like ''%css'' or URLstem like ''%jpg''or URLstem like ''%exe''or URLstem like ''%html''or URLstem like ''%aspx'' or URLstem like ''%ref'' or URLstem like ''%/%''");
while (rs.next())
{
//****************************EM Algorithm **************************
String vs=rs.getString("URLstem");
if((vs.contains("jpg"))||(vs.contains("gif"))||(vs.contains("css")))
{
jTextArea1.append(vs+"\n");
as[ik]=vs;
ik++;
}else if((vs.contains("html"))||(vs.contains("exe"))||(vs.contains("aspx"))||(vs.contains("ref"))||(vs.contains("ico")))
{
jTextArea1.append(vs+"\n");
}
}
} catch (SQLException ex) {
} catch (ClassNotFoundException ex) {
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// String sd=jTextField1.getText();
Connection c = DriverManager.getConnection("jdbc:odbc:"+pa+"");
Statement st = c.createStatement();
ResultSet rs;
String o=" " ;
int i=0;
while(i<=ik)
{
st.executeUpdate("delete from "+pas+" where URLstem=''"+as[i]+"''");
i++;
}
JOptionPane.showMessageDialog((Component) null,"Data has been deleted","Click OK",JOptionPane.INFORMATION_MESSAGE);
} catch (SQLException ex) {
//Logger.getLogger(logupdate.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
//Logger.getLogger(logupdate.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
hide();
new form4().setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see https://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(form3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(form3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(form3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(form3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new form3().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea2;
// End of variables declaration
}
(
explanation of this algorithm)