Home   Family   Softwares   Resume   Activities  


import java.applet.Applet;
import java.awt.*;
import java.sql.*;

public class AllDisplay extends Applet {
          //Delare variables of type List and Frame
          List theList;
          List theList1;
          List theList2;
          Frame theFrame;
          Frame theFrame1;
          Frame theFrame2;
          public void init() {
          //Create string to store driver syntax
          String url = "jdbc:odbc:MySQLDSN";
          //Instanciate the variables
          theList = new List(20, true);
          theList1 = new List(20, true);
          theList2 = new List(20, true);
          theFrame = new Frame();
          theFrame1 =new Frame();
          theFrame2 = new Frame();
          //Declare connection object
          Connection con;
          //Create string to store SQL query
          String query = "select * from DOWNLOAD_TRACK where FILENAME like 'EnquireInstall.zip' order by EMAIL_ADDR ";
          String query1 = "select * from DOWNLOAD_TRACK where FILENAME like 'EnlistSetup2.exe' order by EMAIL_ADDR ";
          //Declare Statement variables
          Statement stmt;
          Statement stmt1;
          Connection con2;
          String query2 = "select FIRST_NAME,LAST_NAME,EMAIL_ADDR from REGISTRATION_INFO order by FIRST_NAME";
          Statement stmt2;
          //Load ODBC Driver by invoking Class.ForName
          try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          }
          catch(java.lang.ClassNotFoundException e)
         {
          System.err.print("ClassNotFoundException: ");
          System.err.println(e.getMessage());
          }
          try
          {
          //Establish a connection is to have the appropriate driver connect to the DBMS
          con = DriverManager.getConnection(url,"priya", "admin");
          //Statement objects are never instanciated directly; instead a program calls the
          //createStatement () method of Connection to obtain new Statement ObjectStatement
          stmt = con.createStatement();
          stmt1 = con.createStatement();
          //A Resultset Object is used to store the returned query results
          ResultSet rs = stmt.executeQuery(query);
          ResultSet rs1 = stmt1.executeQuery(query1);
          con2 = DriverManager.getConnection(url,"priya", "admin");
          stmt2 = con2.createStatement();
          ResultSet rs2 = stmt2.executeQuery(query2);
          //Use Next method of Result set to move from row ro row
          while (rs.next())
          {
          //Retrieve column values with GetString method
          String s = rs.getString("FILENAME");
          String s1 = rs.getString("EMAIL_ADDR");
          Date d = rs.getDate("DOWNLOAD_DATE");
          String text = s + " " + s1 + " " + d;
          //Add column values to List object the list from string Text
          theList.add(text);
          }
          while (rs1.next())
          {
          String s = rs1.getString("FILENAME");
          String s1 = rs1.getString("EMAIL_ADDR");
          Date d = rs1.getDate("DOWNLOAD_DATE");
          String text = s + " " + s1 + " " + d;
          theList1.add(text);
          }
          while (rs2.next())
          {
          String s = rs2.getString("FIRST_NAME");
          String s1 = rs2.getString("LAST_NAME");
          String d = rs2.getString("EMAIL_ADDR");
          String text = s + " " + s1 + " " + d;
          theList2.add(text);
          }
          stmt.close();
          con.close();
          stmt2.close();
          con2.close();
          }
          catch(SQLException ex)
          {
          System.err.print("SQLException: ");
          System.err.println(ex.getMessage());
          }
          //Set the appearance of theList Object
          theList.setBackground(Color.cyan);
          theList1.setBackground(Color.lightGray);
          theList2.setBackground(Color.orange);
          //Set the appearance of theFrame Object
          theFrame.setBackground(Color.cyan);
          theFrame1.setBackground(Color.lightGray);
          theFrame2.setBackground(Color.orange);
          //Load List into the Frame
          theFrame2.add(theList2);
          theFrame.add(theList);
          theFrame1.add(theList1);
          //Display Frame
          theFrame.show();
          theFrame1.show();
          theFrame2.show();
          }
          }
         

1
Hosted by www.Geocities.ws