home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jruntime.z / EmployeeData.java < prev    next >
Text File  |  1997-08-25  |  1KB  |  46 lines

  1. // This snippet creates a new data module
  2. // that is connected to the Dataset Tutorial database
  3. // <File=EmployeeData.java>
  4.  
  5. //Title:
  6. //Version:
  7. //Copyright:
  8. //Author:
  9. //Company:
  10. //Description:
  11. //
  12.  
  13. //<PACKAGE>
  14.  
  15. import borland.jbcl.dataset.*;
  16.  
  17. public class EmployeeData implements DataModule {
  18.   private static EmployeeData myDM;
  19.   Database database1 = new Database();
  20.   QueryDataSet queryDataSet1 = new QueryDataSet();
  21.  
  22.   public EmployeeData() {
  23.     try {
  24.       jbInit();
  25.     }
  26.     catch (Exception e) {
  27.       e.printStackTrace();
  28.     }
  29.   }
  30.  
  31.   void jbInit() throws Exception {
  32.     database1.setConnection(new borland.jbcl.dataset.ConnectionDescriptor("jdbc:odbc:dataset tutorial", "sysdba", "masterkey", false, "sun.jdbc.odbc.JdbcOdbcDriver;borland.interclient.Driver"));
  33.     queryDataSet1.setQuery(new borland.jbcl.dataset.QueryDescriptor(database1, "select * from employee", null, true, false));
  34.   }
  35.  
  36.   static public EmployeeData getDataModule() {
  37.     if (myDM == null)
  38.       myDM = new EmployeeData();
  39.     return myDM;
  40.   }
  41.  
  42.   public borland.jbcl.dataset.QueryDataSet getQueryDataSet1() {
  43.     return queryDataSet1;
  44.   }
  45. }
  46.