DRUG INFORMATION SYSTEM




             IDS 517
        Project Report by:


          GARY LANCE




            MAY 6, ...
TABLE OF CONTENTS



I. INTRODUCTION.........................................................................................
SelectAllDrugNamesLikeRow.java...............................................................................................
I. INTRODUCTION


We’ve designed and implemented an IBM Websphere based application that enables users to pull information...
II. SCREEN SHOTS OF THE PROGRAM

This is the opening page. The right side is the administrator login area.




The left li...
If you press “LOGIN” without entering your Sign-in ID and/or Password, the following screen will appear.




If you put in...
If you are new administrator, you should register. When you press “REGISTER” button, the following screen
will appear.



...
If you’re registered successfully, the following message will appear.




Administrator can login using his Sign-in ID and...
If you’re logged on successfully, the following message will appear.




Additional queries are available to a logged-in a...
When you select “Administrator Management” query, following screen appears. You can register a new
administrator by pressi...
When you press “Delete/Modify Administrator” button, the following screen will appear. It has the
administrator informatio...
When you press “Modify” button, the following screen will appear. It has the new information of Gary Lance.




In order t...
When you press “Delete/Modify Administrator” button, the following screen will appear. It has the
administrator informatio...
You can add a new drug vendor by selecting “Add New Drug Vendor” query from the list and pressing
“Process” button.




Wh...
When you press “Add Vendor to Database”, following screen will appear, so that you can continue to add
new vendors. Notice...
You can log off using the button on the homepage. When you press the “Log Off” button and logged off
successfully, the fol...
When you press “Process”, the following screen will appear.




In order to see all the ingredients in the database, selec...
When you press “Process”, the following screen will appear.




You can use an ingredient as a search term to find the dru...
In order to see all the manufacturers in the database, select “Manufacturer List” query and press “Process.”




When you ...
When you press “Info” button next to a manufacturer, a new window with detailed manufacturer information
will appear.




...
In order to see all the obsolete drugs in the database, select “All Obsolete Drugs” query and press “Process.”




When yo...
In the list boxes, pick month, day and year. Only the drugs that are made obsolete on or after this date will be
listed. T...
In order to search for drugs, select “Query on Drug Names” query and press “Process.”




When you press “Process”, the fo...
You can use a search term to search for drugs. In this example “live” is entered as search term.




After you press “Sear...
At the bottom of the main page, there are three links to web pages which have information about drugs.




When you click ...
When you click “MedlinePlus”, the following web page will appear.




When you click “WebMD”, the following web page will ...
III. ENTITY RELATIONSHIP DIAGRAM

                  multum_
                                           unit_description
  ...
IV. CREATE TABLE STATEMENTS

The following output was generated by the Java program AccessToDB2. The numbered items are, f...
Create table ids517team2.product_strength (
        product_strength_code INTEGER NOT NULL,
        product_strength_descr...
********** Create CORE_DESCRIPTION ****************

Table core_description does not exist
1. ndc_code VARCHAR(11)
2. main...
strength_num_unit INTEGER NOT NULL,
      strength_denom_amount REAL NOT NULL,
      strength_denom_unit INTEGER NOT NULL,...
V. QUERIES PERFORMED IN THE PROGRAM BY USERS AND ADMINISTRATORS

Brand Name List
SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BR...
•   Show Products of the Manufacturer
       SELECT DISTINCT D.SOURCE_DESC, B.BRAND_DESCRIPTION, C.OBSOLETE_DATE
       FR...
•   Insert New Administrator
        INSERT INTO IDS517TEAM2.ADMIN(CODENAME, USERID, FIRSTNAME, LASTNAME,
        STREET, ...
VI. ABOUT THE MULTUM DATABASE


A description of the tables in the Multum database can be found in the Multum Lexicon, dow...
•   acetaminophen 325 mg oral tablets
   •   acetaminophen 325 mg rectal suppositories
   •   acetaminophen 650 mg oral ca...
VII. CREATION OF IBM DB2 TABLES FROM MS ACCESS TABLES

The data for the project were created from the Multum tables. The e...
is more efficient than the continuous concatenation of String objects. The method toString() will eventually be
used to cr...
28.       else if(fieldType[i].trim().equalsIgnoreCase("DOUBLE")){
29.          fieldSize[i] = "";
30.       }
31.       e...
61.       ps.setDate( 4, resultSet.getDate("OBSOLETE_DATE") );
62.       ps.setInt( 5, resultSet.getInt("SOURCE_ID") );
63...
VIII. JAVABEAN FILES


DeleteAdministrator.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This ...
modify.setParameter("codename", codename);
            modify.setParameter("userid", userid);
            modify.execute()...
DrugsByMfg.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBSelect property...
// Free resources of select object.
        finally
        {
           select.close();
        }
    }

    /**
      * ...
DrugsByMfgRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class represents a specific r...
GetAdminLogonInfo.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBSelect p...
{
            select.close();
        }
    }

    /**
      * Returns a DBSelect reference.
      */
    public DBSelect ...
GetAdminLogonInfoRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class represents a spe...
GetAnAdministrator.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBSelect ...
select.setParameter("username", username);
            select.setParameter("userid", userid);
            select.execute()...
GetAnAdministratorRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class represents a sp...
public Object getADMIN_STATE() throws SQLException
    {
      return select.getCacheValueAt(rowNumber, 7);
    }

    /**...
GetMfgRowFromCode.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBSelect p...
/**
      * Returns a DBSelect reference.
      */
    public DBSelect getDBSelect()
    {
      return select;
    }

   ...
GetMfgRowFromCodeRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class represents a spe...
public Object getDRUG_SOURCE_URL() throws SQLException
    {
      return select.getCacheValueAt(rowNumber, 7);
    }

   ...
GetMfgRowFromCodeRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class represents a spe...
public Object getDRUG_SOURCE_URL() throws SQLException
    {
      return select.getCacheValueAt(rowNumber, 7);
    }

   ...
GetNextMfgSourceId.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBSelect ...
{
        GetNextMfgSourceIdRow[] rows =
           new GetNextMfgSourceIdRow[select.getRowCount()];
        for (int i = ...
GetNextMfgSourceIdRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class represents a sp...
Global.java

/*
 * Created on Jan 7, 2004
 *
 * To change the template for this generated file go to
 * Window>Preferen...
IngredientListForBrandNamesLike.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets ...
select.setParameter("name1", name1);
            select.setParameter("name2", name2);
            select.execute();
      ...
IngredientListForBrandNamesLikeRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class re...
InsertAdmin.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBModify propert...
parmMetaData.setParameter(
             7,
             "state",
             java.sql.DatabaseMetaData.procedureColumnIn,...
InsertVendor.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBModify proper...
7,
             "url",
             java.sql.DatabaseMetaData.procedureColumnIn,
             java.sql.Types.VARCHAR,
    ...
SelectAllBrands.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBSelect pro...
* Returns an array of objects representing the rows in the result set.
      */
    public SelectAllBrandsRow[] getRows()
...
SelectAllBrandsLike.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class sets the DBSelect...
select.close();
        }
    }

    /**
      * Returns a DBSelect reference.
      */
    public DBSelect getDBSelect()
...
SelectAllBrandsLikeRow.java

package drug;
import java.sql.*;
import com.ibm.db.beans.*;

/**
 * This class represents a s...
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Lance Drug IS WSAD Manual
Upcoming SlideShare
Loading in...5
×

Lance Drug IS WSAD Manual

382

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
382
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Lance Drug IS WSAD Manual"

  1. 1. DRUG INFORMATION SYSTEM IDS 517 Project Report by: GARY LANCE MAY 6, 2004
  2. 2. TABLE OF CONTENTS I. INTRODUCTION.............................................................................................................................................4 II. SCREEN SHOTS OF THE PROGRAM.........................................................................................................5 III. ENTITY RELATIONSHIP DIAGRAM......................................................................................................27 IV. CREATE TABLE STATEMENTS..............................................................................................................28 V. Queries Performed in the Program by Users and Administrators.................................................................32 VI. ABOUT THE MULTUM DATABASE......................................................................................................35 VII. CREATION OF IBM DB2 TABLES FROM MS ACCESS TABLES......................................................37 VIII. JAVABEAN FILES...................................................................................................................................41 DeleteAdministrator.java................................................................................................................................41 DrugsByMfg.java...........................................................................................................................................43 DrugsByMfgRow.java....................................................................................................................................45 GetAdminLogonInfo.java...............................................................................................................................46 GetAdminLogonInfoRow.java.......................................................................................................................48 GetAnAdministrator.java...............................................................................................................................49 GetAnAdministratorRow.java........................................................................................................................51 GetMfgRowFromCode.java...........................................................................................................................53 GetMfgRowFromCodeRow.java....................................................................................................................55 GetMfgRowFromCodeRow.java....................................................................................................................57 GetNextMfgSourceId.java..............................................................................................................................59 GetNextMfgSourceIdRow.java......................................................................................................................61 Global.java......................................................................................................................................................62 IngredientListForBrandNamesLike.java........................................................................................................63 IngredientListForBrandNamesLikeRow.java.................................................................................................65 .......................................................................................................................................................................65 InsertAdmin.java............................................................................................................................................66 InsertVendor.java...........................................................................................................................................68 SelectAllBrands.java......................................................................................................................................70 SelectAllBrandsLike.java...............................................................................................................................72 SelectAllBrandsLikeRow.java.......................................................................................................................74 SelectAllBrandsRow.java...............................................................................................................................75 SelectAllDrugNamesLike.java.......................................................................................................................76 2
  3. 3. SelectAllDrugNamesLikeRow.java...............................................................................................................78 SelectAllMfgInfo.java....................................................................................................................................79 SelectAllMfgInfoRow.java.............................................................................................................................81 SelectAllMfgs.java.........................................................................................................................................83 SelectAllMfgsRow.java..................................................................................................................................85 SelectDrugNames.java...................................................................................................................................86 SelectDrugNamesRow.java............................................................................................................................88 SelectObsoleteDrugs.java...............................................................................................................................89 SelectObsoleteDrugsRow.java.......................................................................................................................91 ShowAllAdministrators.java..........................................................................................................................92 ShowAllAdministratorsRow.java...................................................................................................................94 UpdateAdminInfo.java...................................................................................................................................96 IX. JAVA SERVER PAGES (JSP) FILES.........................................................................................................98 admin.jsp.........................................................................................................................................................98 brands.jsp .....................................................................................................................................................100 checkAdmin.jsp............................................................................................................................................101 confirmAdminDelete.jsp .............................................................................................................................103 doVendorInsert.jsp ......................................................................................................................................105 drugNames.jsp .............................................................................................................................................106 drugsByMfg.jsp ...........................................................................................................................................108 index.jsp .......................................................................................................................................................110 ingredList1.jsp .............................................................................................................................................112 insertVendor.jsp ...........................................................................................................................................114 logoff.jsp ......................................................................................................................................................116 mfgInfo.jsp ..................................................................................................................................................117 mfgs.jsp ........................................................................................................................................................119 register.jsp ....................................................................................................................................................121 selectObsoleteDrugs.jsp ..............................................................................................................................122 showAllAdministrators.jsp ..........................................................................................................................124 updateAdminInfo.jsp ...................................................................................................................................127 userDeleted.jsp ............................................................................................................................................128 3
  4. 4. I. INTRODUCTION We’ve designed and implemented an IBM Websphere based application that enables users to pull information about drugs from a central database. This information includes: • Manufacturers • Generic names • Brand names • Inactive Drugs • Ingredients Our website is available to everyone. There are two kinds of users: administrators and public. Both types of users use the same main page. Administrators have to register before using some extra features. After logged in, an administrator can add, delete or modify administrators and add drug vendors which do not exist in the database. By using our website, public can get general information about drugs. We wanted to give answers to common questions such as “Is the drug currently on the market?” “How many different manufacturers produce the same product?” “What’re the ingredients of a drug?” “What brand names exist for given a generic product?” We answer these questions by providing a query list. Our list has the following queries: • Brand Name List • Ingredient List • Manufacturer List • All Obsolete Drugs • Query on Drug Names • Administrator Management • Add New Vendor Our website also provides three important links to other websites which have information about drugs. These are Medicare, MedlinePlus and WebMD. If a user cannot find the information about a drug, he can go to these websites and make an extended research. There are many excellent sources of information online. Our project, being of such small scope, is not meant to replace them, but to emulate a few prominent features which are available in most of the online resources. This project is the first step towards creating a substantial, beneficial source of drug-related information. But it will not currently be able to give advice. For that type of application, one would need to have physicians and other drug professionals on staff. 4
  5. 5. II. SCREEN SHOTS OF THE PROGRAM This is the opening page. The right side is the administrator login area. The left list box displays the queries. Insert and update queries are only available for the administrator, who must logon. 5
  6. 6. If you press “LOGIN” without entering your Sign-in ID and/or Password, the following screen will appear. If you put in Sign-in ID and Password combination that is not in database, the following screen will appear. 6
  7. 7. If you are new administrator, you should register. When you press “REGISTER” button, the following screen will appear. In order to register, administrator should provide the following information and press “REGISTER” button. All fields must be filled in. It adds information to the ADMIN table. 7
  8. 8. If you’re registered successfully, the following message will appear. Administrator can login using his Sign-in ID and Password. An HttpSession object allows the creation of a key/value pair, using the setAttribute() method. This method can be tested using getAttribute() method. 8
  9. 9. If you’re logged on successfully, the following message will appear. Additional queries are available to a logged-in administrator. Notice “Administrator Management” and “Add Drug Vendor” queries. These queries appear only if the user is logged in as an administrator. User and administrator share the same start page. 9
  10. 10. When you select “Administrator Management” query, following screen appears. You can register a new administrator by pressing the “Register” button and providing the information. On this screen all administrators in database are shown, with complete information. In order to modify an administrator information, username and password of that administrator should be entered and “Delete/Modify Administrator” button should be pressed. 10
  11. 11. When you press “Delete/Modify Administrator” button, the following screen will appear. It has the administrator information that you can modify. But you can’t change the username or userid. You can change the administrator information by entering the new information into textfields. On the following screen, Gary Lance’s address and phone is changed. 11
  12. 12. When you press “Modify” button, the following screen will appear. It has the new information of Gary Lance. In order to modify administrator information, username and password of that administrator should be entered and “Delete/Modify Administrator” button should be pressed. 12
  13. 13. When you press “Delete/Modify Administrator” button, the following screen will appear. It has the administrator information that you want to delete. You can delete the record by pressing “OK to Delete” button. When you press “OK to Delete” button, the following screen will appear. Notice the administrator that you’ve deleted is not in the list. 13
  14. 14. You can add a new drug vendor by selecting “Add New Drug Vendor” query from the list and pressing “Process” button. When you press “Process” button, following screen will appear. The table Ndc_source lists all the vendors by SourceID. This table is queried to return one or more than the maximum SourceID. This value is placed in the “Source ID” text field. It is a read only field which means the user cannot change the value. Otherwise, the user might enter a currently used SourceID. In order to add a new vendor; the fields on the following screen should be filled in. 14
  15. 15. When you press “Add Vendor to Database”, following screen will appear, so that you can continue to add new vendors. Notice SourceID is incremented. 15
  16. 16. You can log off using the button on the homepage. When you press the “Log Off” button and logged off successfully, the following message will appear. In order to see all the brand names in the database, select “Brand Name List” query and press “Process.” 16
  17. 17. When you press “Process”, the following screen will appear. In order to see all the ingredients in the database, select “Ingredient List” query and press “Process.” 17
  18. 18. When you press “Process”, the following screen will appear. You can use an ingredient as a search term to find the drug names which have that ingredient. When you enter the search term and press “Process” following screen will appear. 18
  19. 19. In order to see all the manufacturers in the database, select “Manufacturer List” query and press “Process.” When you press “Process”, the following screen will appear. 19
  20. 20. When you press “Info” button next to a manufacturer, a new window with detailed manufacturer information will appear. When you press “Products” button next to a manufacturer, a new window with a list of manufacturer’s products will appear. 20
  21. 21. In order to see all the obsolete drugs in the database, select “All Obsolete Drugs” query and press “Process.” When you press “Process”, the following screen will appear. 21
  22. 22. In the list boxes, pick month, day and year. Only the drugs that are made obsolete on or after this date will be listed. The date “February 3, 2004” has been selected in the example below. After selecting date, press the “PROCESS” button. When you press “Process”, following screen displays all the drugs made obsolete on or after “February 3, 2004”. They are sorted by NDC. 22
  23. 23. In order to search for drugs, select “Query on Drug Names” query and press “Process.” When you press “Process”, the following screen will appear. 23
  24. 24. You can use a search term to search for drugs. In this example “live” is entered as search term. After you press “Search for Drug Names” button, the following screen will appear. It lists the drugs that have the search key “live” in their names. 24
  25. 25. At the bottom of the main page, there are three links to web pages which have information about drugs. When you click “Medicare”, the following web page will appear. 25
  26. 26. When you click “MedlinePlus”, the following web page will appear. When you click “WebMD”, the following web page will appear. 26
  27. 27. III. ENTITY RELATIONSHIP DIAGRAM multum_ unit_description units unit_id active_ dose form strength_ ingredient description strength_ denom_ num_ unit amount dose_form active_ strength_ route_ ingredient num_ description amount dose form product_strength ingredient_ code strength_ strength Route active_ denom_ ingredient_ amount product_ product_ product code strength strength_ strength_ route_code Dose_form_ description code code ingredient_ Code strength_ code active_ ingredient_ code route_code Drug_code drug_id drug_id Drug_Id drug_name ingredient_ active_ strength_ drug_code drug_code ingredient_list code DUPLICATES drug_code NDC_code source_desc address URL Core_description brand_description Ndc_source source_id source_id Obsolete_date brand_code brand_code city state zip Brand_Name 27
  28. 28. IV. CREATE TABLE STATEMENTS The following output was generated by the Java program AccessToDB2. The numbered items are, for each table, the field names and the MS Access types. The “Create table” statement is the IBM DB2 statement that creates the IBM DB2 table. Notice that, although the order of the fields for IBM DB2 is identical to that of MS Access, so of the field names have been changed. Some of the types have also changed, as MS Access and IBM DB2 types are not 100% compatible. ********** Create DRUG_SOURCE **************** Table drug_source does not exist 1. source_id SMALLINT(5) 2. source_desc VARCHAR(120) 3. address1 VARCHAR(100) 4. city VARCHAR(50) 5. state VARCHAR(2) 6. zip VARCHAR(10) Create table ids517team2.drug_source ( source_id SMALLINT NOT NULL, source_desc VARCHAR(120) NOT NULL, address VARCHAR(100) NOT NULL, city VARCHAR(50) NOT NULL, state VARCHAR(2) NOT NULL, zip VARCHAR(10) NOT NULL, URL VARCHAR(155), CONSTRAINT PK_DRUG_SOURCE PRIMARY KEY(source_id)) ********** Create BRAND_NAME **************** Table brand_name does not exist 1. brand_code INTEGER(10) 2. brand_description VARCHAR(255) Create table ids517team2.brand_name ( brand_code INTEGER NOT NULL, brand_description VARCHAR(255) NOT NULL, CONSTRAINT PK_BRAND_NAME PRIMARY KEY(brand_code)) ********** Create DRUG_ID **************** Table drug_id does not exist 1. drug_id VARCHAR(6) 2. drug_name VARCHAR(255) Create table ids517team2.drug_id ( drug_id VARCHAR(6) NOT NULL, drug_name VARCHAR(255) NOT NULL, CONSTRAINT PK_DRUG_ID PRIMARY KEY(drug_id)) ********** Create PRODUCT_STRENGTH **************** Table product_strength does not exist 1. product_strength_code INTEGER(10) 2. product_strength_description VARCHAR(255) 28
  29. 29. Create table ids517team2.product_strength ( product_strength_code INTEGER NOT NULL, product_strength_description VARCHAR(255) NOT NULL, CONSTRAINT PK_PROD_STRENGTH PRIMARY KEY(product_strength_code)) ********** Create DOSE FORM **************** Table dose_form does not exist 1. dose_form_code INTEGER(10) 2. dose_form_description VARCHAR(255) Create table ids517team2.dose_form ( dose_form_code INTEGER NOT NULL, dose_form_description VARCHAR(255) NOT NULL, CONSTRAINT PK_DOSE_FORM PRIMARY KEY(dose_form_code)) ********** Create ROUTE **************** Table route does not exist 1. route_code INTEGER(10) 2. route_description VARCHAR(255) Create table ids517team2.route ( route_code INTEGER NOT NULL, route_description VARCHAR(255) NOT NULL, CONSTRAINT PK_ROUTE PRIMARY KEY(route_code)) ********** Create DRUG_CODE **************** Table drug_code does not exist 1. main_multum_drug_code INTEGER(10) 2. principal_route_code INTEGER(10) 3. dose_form_code INTEGER(10) 4. product_strength_code INTEGER(10) 5. drug_id VARCHAR(6) Create table ids517team2.drug_code ( drug_code INTEGER NOT NULL, route_code INTEGER NOT NULL, dose_form_code INTEGER NOT NULL, product_strength_code INTEGER NOT NULL, drug_id VARCHAR(6) NOT NULL, CONSTRAINT PK_DRUG_CODE PRIMARY KEY(drug_code), CONSTRAINT FK_ROUTE_CODE FOREIGN KEY(route_code) REFERENCES ids517team2.route (route_code), CONSTRAINT FK_DOSE_FORM_CODE FOREIGN KEY(dose_form_code) REFERENCES ds517team2.dose_form, CONSTRAINT FK_PROUCT_STR_CODE FOREIGN KEY(product_strength_code) REFERENCES ids517team2.product_strength, CONSTRAINT FK_DRUG_ID FOREIGN KEY(drug_id) REFERENCES ids517team2.drug_id)) 29
  30. 30. ********** Create CORE_DESCRIPTION **************** Table core_description does not exist 1. ndc_code VARCHAR(11) 2. main_multum_drug_code INTEGER(10) 3. brand_code INTEGER(10) 4. obsolete_date DATETIME(19) 5. source_id INTEGER(10) Create table ids517team2.core_description ( ndc_code VARCHAR(11) NOT NULL, drug_code INTEGER, brand_code INTEGER, obsolete_date DATE, source_id INTEGER, CONSTRAINT PK_CORE_DESC PRIMARY KEY(ndc_code), CONSTRAINT FK_SOURCE_ID FOREIGN KEY(source_id) REFERENCES ids517team2.drug_source, CONSTRAINT FK_DRUG_CODE FOREIGN KEY(drug_code) REFERENCES ids517team2.drug_code, CONSTRAINT FK_BRAND_CODE FOREIGN KEY(brand_code) REFERENCES ids517team2.brand_name) ********** Create ACTIVE_INGREDIENT **************** Table active_ingredient does not exist 1. active_ingredient_code INTEGER(10) 2. active_ingredient VARCHAR(255) Create table ids517team2.active_ingredient ( active_ingredient_code INTEGER NOT NULL, active_ingredient VARCHAR(255), CONSTRAINT PK_ACTIVE_INGRED PRIMARY KEY(active_ingredient_code)) ********** Create MULTUM_UNITS **************** Table multum_units does not exist 1. unit_id INTEGER(10) 2. unit_description VARCHAR(255) Create table ids517team2.multum_units ( unit_id INTEGER NOT NULL, unit_description VARCHAR(255) NOT NULL, CONSTRAINT PK_UNITS PRIMARY KEY(unit_id)) ********** Create INGREDIENT_STRENGTH **************** Table ingredient_strength does not exist 1. ingredient_strength_code INTEGER(10) 2. strength_num_amount DOUBLE(15) 3. strength_num_unit INTEGER(10) 4. strength_denom_amount DOUBLE(15) 5. strength_denom_unit INTEGER(10) Create table ids517team2.ingredient_strength ( ingredient_strength_code INTEGER NOT NULL, strength_num_amount REAL NOT NULL, 30
  31. 31. strength_num_unit INTEGER NOT NULL, strength_denom_amount REAL NOT NULL, strength_denom_unit INTEGER NOT NULL, CONSTRAINT PK_INGRED_STR PRIMARY KEY(ingredient_strength_code), CONSTRAINT FK_STR_NUM FOREIGN KEY(strength_num_unit) REFERENCES ids517team2.multum_units(unit_id), CONSTRAINT FK_STR_DENOM FOREIGN KEY(strength_denom_unit) REFERENCES ids517team2.multum_units(unit_id)) ********** Create ACTIVE_INGREDIENT_LIST **************** Table active_ingredient_list does not exist 1. main_multum_drug_code INTEGER(10) 2. active_ingredient_code INTEGER(10) 3. ingredient_strength_code INTEGER(10) Create table ids517team2.active_ingredient_list ( drug_code INTEGER NOT NULL, active_ingredient_code INTEGER NOT NULL, ingredient_strength_code INTEGER NOT NULL, CONSTRAINT PK_ACTIVE_LIST PRIMARY KEY(drug_code, active_ingredient_code, ingredient_strength_code), CONSTRAINT FK_STR_CODE FOREIGN KEY(active_ingredient_code) REFERENCES ids517team2.active_ingredient, CONSTRAINT FK_INGRED FOREIGN KEY(ingredient_strength_code) REFERENCES ids517team2.ingredient_strength, CONSTRAINT FK_DRUG_CODE FOREIGN KEY(drug_code) REFERENCES ids517team2.drug_code)) 31
  32. 32. V. QUERIES PERFORMED IN THE PROGRAM BY USERS AND ADMINISTRATORS Brand Name List SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME Ingredient List SELECT DISTINCT X.DRUG_NAME, A.ACTIVE_INGREDIENT FROM IDS517TEAM2.ACTIVE_INGREDIENT AS A, IDS517TEAM2.ACTIVE_INGREDIENT_LIST AS I, IDS517TEAM2.DRUG_CODE AS D, IDS517TEAM2.DRUG_ID AS X WHERE A.ACTIVE_INGREDIENT_CODE = I.ACTIVE_INGREDIENT_CODE AND I.DRUG_CODE = D.DRUG_CODE AND D.DRUG_ID = X.DRUG_ID AND A.ACTIVE_INGREDIENT_CODE IN ( SELECT L.ACTIVE_INGREDIENT_CODE FROM IDS517TEAM2.ACTIVE_INGREDIENT_LIST AS L WHERE L.DRUG_CODE IN ( SELECT C.DRUG_CODE FROM IDS517TEAM2.DRUG_ID AS B, IDS517TEAM2.DRUG_CODE AS C WHERE B.DRUG_ID = C.DRUG_ID AND B.DRUG_NAME LIKE :name1 ) ) AND X.DRUG_NAME LIKE :name2 Manufacturer List • Show All the Manufacturers SELECT D.SOURCE_ID, D.SOURCE_DESC FROM IDS517TEAM2.DRUG_SOURCE D ORDER BY D.SOURCE_DESC • Show Manufacturer Information SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_ID, IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.DRUG_SOURCE.ADDRESS, IDS517TEAM2.DRUG_SOURCE.CITY, IDS517TEAM2.DRUG_SOURCE.STATE, IDS517TEAM2.DRUG_SOURCE.ZIP, IDS517TEAM2.DRUG_SOURCE.URL FROM IDS517TEAM2.DRUG_SOURCE 32
  33. 33. • Show Products of the Manufacturer SELECT DISTINCT D.SOURCE_DESC, B.BRAND_DESCRIPTION, C.OBSOLETE_DATE FROM IDS517TEAM2.DRUG_SOURCE AS D, IDS517TEAM2.CORE_DESCRIPTION AS C, IDS517TEAM2.BRAND_NAME AS B WHERE D.SOURCE_ID = C.SOURCE_ID AND C.BRAND_CODE = B.BRAND_CODE AND D.SOURCE_ID = :code ORDER BY SOURCE_DESC, BRAND_DESCRIPTION All Obsolete Drugs SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.CORE_DESCRIPTION.NDC_CODE, IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME, IDS517TEAM2.CORE_DESCRIPTION, IDS517TEAM2.DRUG_SOURCE WHERE IDS517TEAM2.BRAND_NAME.BRAND_CODE = IDS517TEAM2.CORE_DESCRIPTION.BRAND_CODE AND IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = IDS517TEAM2.CORE_DESCRIPTION.SOURCE_ID AND IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE >= :date ORDER BY NDC_CODE ASC, BRAND_DESCRIPTION ASC, SOURCE_DESC ASC, OBSOLETE_DATE ASC Query on Drug Names SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME WHERE IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION LIKE :descr Administrator Management • Show All Administrators SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID, IDS517TEAM2.ADMIN.FIRSTNAME, IDS517TEAM2.ADMIN.LASTNAME, IDS517TEAM2.ADMIN.STREET, IDS517TEAM2.ADMIN.CITY, IDS517TEAM2.ADMIN.STATE, IDS517TEAM2.ADMIN.ZIP, IDS517TEAM2.ADMIN.PHONE FROM IDS517TEAM2.ADMIN 33
  34. 34. • Insert New Administrator INSERT INTO IDS517TEAM2.ADMIN(CODENAME, USERID, FIRSTNAME, LASTNAME, STREET, STATE, ZIP, PHONE) VALUES (:codename, :firstname, : lastname, :street, :city, :state, :zip, :phone) • Show the Information of an Administrator SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID, IDS517TEAM2.ADMIN.FIRSTNAME, IDS517TEAM2.ADMIN.LASTNAME, IDS517TEAM2.ADMIN.STREET, IDS517TEAM2.ADMIN.CITY, IDS517TEAM2.ADMIN.STATE, IDS517TEAM2.ADMIN.ZIP, IDS517TEAM2.ADMIN.PHONE FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME = :username AND IDS517TEAM2.ADMIN.USERID = :userid • Update Administrator Information UPDATE IDS517TEAM2.ADMIN SET FIRSTNAME = :firstname, LASTNAME = :lastname, STREET = :street, CITY = :city, STATE = :state, ZIP = :zip, PHONE = :phone WHERE IDS517TEAM2ADMIN.CODENAME = :codename AND IDS517TEAM2.ADMIN.USERID = :userid • Delete an Existing Administrator DELETE FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME = :codename AND IDS517TEAM2.ADMIN.USERID = :userid Add New Vendor INSERT INTO IDS517TEAM2.DRUG_SOURCE (SOURCE_ID, SOURCE_DESC, ADDRESS, CITY, STATE, ZIP, URL) VALUES (:id, :descr, :address, :city, :state, :zip, :url) 34
  35. 35. VI. ABOUT THE MULTUM DATABASE A description of the tables in the Multum database can be found in the Multum Lexicon, downloadable from http://205.169.47.10/Lexicon.htm. The database is an MS Access database. Users need to be knowledgable in MS Access and Structured Query Language (SQL) in order to extract information from the lexicon. The information in this section has been extracted from the Lexicon. Each drug number in the database includes a unique combination of: • ingredients (represented by the drug_id: acetaminophen), • strength (represented by the product_strength_code – 325 mg, 650 mg, 120 mg/2.5 ml, 120 mg/5 ml), • route (represented by the principal_route_code - oral, rectal), and • dose form (represented by the dose_form_code - tablet, suppository, capsule, solution, elixir). Each (ingredient) strength in the database has a unique identifier (so it can be reused with many other active ingredients). The identifier is called the ingredient_strength_code. Each ingredient_strength_code is associated with a unique combination of the following four fields: 1. strength_num_amount 2. strength_num_unit 3. strength_denom_amount 4. strength_denom_unit For example, if the strength of a particular liquid ingredient in a drug is 125 mg/5 ml, then: strength_num_amount = 125 strength_num_unit = 4 (mg) strength_denom_amount = 5 strength_denom_unit = 5 (ml) Active_ingredient is for the pharmacists. Active_ingredient is always a generic name. In the case of mono- ingredient drugs, the active_ingredient is a simple description of the generic chemical name of the drug in question, including all the pharmacist-friendly information tacked on the end. Each drug code is associated with at least one active_ingredient, but can be associated with an unlimited number of active_ingredients via the ndc_active_ingredient_list table – another table in the database. Drug_ids correspond to the generic names of drugs. Unfortunately, any given drug can have one or more active ingredients that are also drugs, and they therefore also have drug_ids. For example, there are a thousand or more different products on the market that contain acetaminophen as a mono-ingredient. (It ís the active ingredient in Tylenol and lots of other drug products.) Many of these products are nearly identical - they may just be packaged differently or sold by different manufacturers under different names. In fact, there are only about 20 different acetaminophen product types. For example, here are a few of them: 35
  36. 36. • acetaminophen 325 mg oral tablets • acetaminophen 325 mg rectal suppositories • acetaminophen 650 mg oral capsules • acetaminophen 120 mg/2.5 ml oral solution • acetaminophen 120 mg/ 5 ml oral elixir Concerning the NDC (National Drug Code), the FDA assigns a labeler code to a manufacturer/repackager of drugs. Basically the FDA is just giving out a series of numbers for a manufacturer/repackager to use. In addition, the FDA requires that each manufacturer/repackager fill out a paper form, which identifies the NDCs the manufacturer/labeler has assigned to its products. Every time the labeler/manufacturer changes the packaging or anything else important about the drug, it is supposed to assign a new NDC. 36
  37. 37. VII. CREATION OF IBM DB2 TABLES FROM MS ACCESS TABLES The data for the project were created from the Multum tables. The entire database can be downloaded from http://205.169.47.10/ForConsumers.htm. A description of the tables in are in the Multum Lexicon, downloadable from http://205.169.47.10/Lexicon.htm. The database is an MS Access database. Users need to be knowledgable in MS Access and Structured Query Language (SQL) in order to extract information from the lexicon. The tables in the database, as explained in the Lexicon, are both normalized and denormalized. For the developer, a query is done using the normalized tables. However, for the average user, there is a table (ndc_denorm) which has a great number of attributes. This table can be used by people wanting to avoid the joins and other operations required in normalized databases. We avoid this table in our project for obvious reasons. The project description required the use of IBM DB2. This posed a problem, as the Multum database is an MS Access database. In addition, the tables required by our program had about 40MByes of data. Thus, entering each record in a newly-created IBM DB2 table was not feasible. In order to accomplish this task, a Java application was created that read the data from the required MS Access (source) tables, and used that data to populate IBM DB2 (target) tables. The database portion of the project had two phases, which ran concurrently. In what follows, source tables will always refer to the MS Access tables, while target tables will always refer to the IBM DB2 tables. First, the source tables had to be queried to discover their composition (field names, types). Secondly, target tables had to be created from the information gathered in the first phase. Finally, the target tables had to be queried to populate the target tables. Phase I: The creation of the IBM DB2 tables was accomplished by getting the metatdata from the source table (from MS Access) and creating a target table (in IBM DB2). The name of the target table was an input. In addition, not all the fields of each source table were required. Before creating the table, the name of the field would be available, so it was easy to not include a given field. The code fragments shown in this section are taken from the Java application AccessToDB2.java, which is the application responsible for the conversion of MS Access data to IBM DB2 data. The initialize() method (shown in the code section) queries the source table for all the rows using the sql statement (SELECT * FROM SOURCETABLE). The method then returns the number of columns in the source table (variable numCol on line 1). By getting the MetaData object, the number of columns, as well as their type and size (eg, VARCHAR(156)) is easily found by an appropriate accessor. This allows the creation of the target table. Lines 10, 11 and 12 store the field names, types and sizes, respectively, in String arrays fieldName, fieldType and fieldSize, respectively. Note that there are two indices (i and j, lines 6 and 7). The index ‘i’ walks through the data corresponding to the source tables. Certain columns are not being used, so they are skipped (line 8). Index ‘j’ represents the columns of the target table. ‘j’ will be at most equal to ‘i’, meaning that the number of target columns will at most equal the number of source columns. On row 21, we determine the number of target columns, and store that value in variable “rows”. On line 20, we create the beginning of the sql statement that creates the target table. Note that we use a StringBuffer variable ‘sb’. This 37
  38. 38. is more efficient than the continuous concatenation of String objects. The method toString() will eventually be used to create a String object out of ‘sb’, and then that String will be used to create the table. 1. numCol = initialize("ndc_source", "drug_source"); 2. // The following indices refer to columns in MS Access 3. // that are not being used in the project. As a result, 4. // we do not process those columns, and they are not 5. // added to the IBM BD2 table. 6. int j = 1; 7. for(int i = 1; i <= numCol; i++){ 8. if( i != 4 && i != 7 && i != 9) 9. { 10. fieldName[j] = rsmd.getColumnName(i); 11. fieldType[j] = rsmd.getColumnTypeName(i); 12. fieldSize[j] = "(" + rsmd.getPrecision(i) + ")"; 13. 14. println(j + ". " + fieldName[j] + "t" + 15. fieldType[j] + fieldSize[j]); 16. ++j; 17. } 18. } 19. // Create the sql statement to create the table 20. sb.append( "Create table " + "ids517team2." + targetTable + "(" ); 21. int rows = j-1; Phase II: We have stored all the information concerning the source tables in the arrays fieldType, fieldSize and fieldName. We must be careful to use sql that will not throw exceptions in JDBC. For example, MS Access has the type and size INTEGER(10). However, the size “(10)” appended to “INTEGER” is not allowed in IBM DB2, as all INTEGERS have a default size of 36 digits. Thus, on line 22, we check if the current fieldName has a fieldType of INTEGER. If it does, we remove the fieldSize on line 23. This same procedure is used for SMALLINT and DOUBLE. For DATETIME, there are two ways the program uses dates and time. If a comparison is required, which is required when determining if the drug is obsolete, we must convert DATETIME to DATE. This is done in the code on lines 44-46. However, if only a character representation is required, it was sufficient to convert the DATETIME to a VARCHAR. Notice, on line 33, we had to add a size to the type VARCHAR (line 32). For each column in the target table, we must check the types. For each column, after the appropriate conversion is accomplished, the sql to create that column is added on line 40. Notice that if we still have columns left in the table, we need to add a comma to the end of each line (shown in line 41). 21. for(int i = 1; i <= rows; i++){ 22. if(fieldType[i].trim().equalsIgnoreCase("INTEGER")){ 23. fieldSize[i] = ""; 24. } 25. else if(fieldType[i].trim().equalsIgnoreCase("SMALLINT")){ 26. fieldSize[i] = ""; 27. } 38
  39. 39. 28. else if(fieldType[i].trim().equalsIgnoreCase("DOUBLE")){ 29. fieldSize[i] = ""; 30. } 31. else if(fieldType[i].trim().equalsIgnoreCase("DATETIME")){ 32. fieldType[i] = "VARCHAR"; 33. fieldSize[i] = "(10)"; 34. } 35. 36. if(fieldName[i].trim().equalsIgnoreCase("address1")){ 37. fieldName[i] = "address"; 38. } 39. 40. sb.append(fieldName[i] + " " + fieldType[i] + fieldSize[i] + " NOT NULL"); 41. if( i != rows ) sb.append(", "); 42. } ...MISSING CODE... 43. else if(fieldType[i].trim().equalsIgnoreCase("DATETIME")){ 44. fieldType[i] = "DATE"; 45. fieldSize[i] = ""; 46. } Phase III: The final phase requires each target table to be populated by querying the associated source table. Since there are many records in the tables, sometimes over 100,000, it is more efficient to create a PreparedStatement object to handle the sql statement and the query to create a new record in the target table. This is done on line 47, where ‘ps’ is a PreparedStatement object. Notice that we go through the code on line 47-56 only once. Once created, all that is left is to step through the ResultSet object (lines 57-65). This object ‘resultSet’ contains all the records of the associated source table. We step through the resultSet one record at a time, extracting the data in each of the field (lines 58-62) and using the PreparedStatement mutators (setDate(), setInt(), etc) to set the fields of the object referenced by ‘ps’. Once this is done, all we need to do is execute the statement, which is done on line 63. Notice that, by the time we reach line 63, the various fields of ‘ps’ have been set, and we send the message “executeUpdate()’ to the object ‘ps’. This results in the query being executed, and a record being added to the respective table. 47. PreparedStatement ps = db2Con.prepareStatement( 48. "INSERT INTO " + schema + targetTable + 49. "(" + 50. fieldName[1] + ", " + // NDC_CODE 51. fieldName[2] + ", " + // DRUG_CODE 52. fieldName[3] + ", " + // BRAND_CODE 53. fieldName[4] + ", " + // OBSOLETE_DATE 54. fieldName[5] + // SOURCE_ID 55. ") VALUES (?,?,?,?,?)" 56. ); 57. while( resultSet.next() ){ 58. ps.setString( 1, resultSet.getString("NDC_CODE") ); 59. ps.setInt( 2, resultSet.getInt("MAIN_MULTUM_DRUG_CODE") ); 60. ps.setInt( 3, resultSet.getInt("BRAND_CODE") ); 39
  40. 40. 61. ps.setDate( 4, resultSet.getDate("OBSOLETE_DATE") ); 62. ps.setInt( 5, resultSet.getInt("SOURCE_ID") ); 63. ps.executeUpdate(); 64. db2Con.commit(); // COMMIT 65. } 40
  41. 41. VIII. JAVABEAN FILES DeleteAdministrator.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBModify property values. It also provides * methods that execute your SQL statement and return * a DBModify reference. * Generated: Jan 7, 2004 4:33:29 PM */ public class DeleteAdministrator { private DBModify modify; /** * Constructor for a DBModify class. */ public DeleteAdministrator() { super(); initializer(); } /** * Creates a DBModify instance and initializes its properties. */ protected void initializer() { modify = new DBModify(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); modify.setCommand( "DELETE FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME = :codename AND IDS517TEAM2.ADMIN.USERID = :userid"); DBParameterMetaData parmMetaData = modify.getParameterMetaData(); parmMetaData.setParameter( 1, "codename", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 2, "userid", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute( String username, String password, String codename, String userid) throws SQLException { try { modify.setUsername(username); modify.setPassword(password); 41
  42. 42. modify.setParameter("codename", codename); modify.setParameter("userid", userid); modify.execute(); } // Free resources of modify object. finally { modify.close(); } } /** * Returns a DBModify reference. */ public DBModify getDBModify() { return modify; } } 42
  43. 43. DrugsByMfg.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 8, 2004 1:32:07 AM */ public class DrugsByMfg { private DBSelect select; /** * Constructor for a DBSelect class. */ public DrugsByMfg() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT DISTINCT IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION, IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE FROM IDS517TEAM2.BRAND_NAME, IDS517TEAM2.CORE_DESCRIPTION, IDS517TEAM2.DRUG_SOURCE WHERE IDS517TEAM2.BRAND_NAME.BRAND_CODE = IDS517TEAM2.CORE_DESCRIPTION.BRAND_CODE AND IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = IDS517TEAM2.CORE_DESCRIPTION.SOURCE_ID AND IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = :code ORDER BY SOURCE_DESC ASC"); DBParameterMetaData parmMetaData = select.getParameterMetaData(); parmMetaData.setParameter( 1, "code", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.SMALLINT, Short.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute( String userid, String password, // int maxRows, Short code) throws SQLException { try { select.setUsername(userid); select.setPassword(password); // select.setMaxRows(maxRows); select.setParameter("code", code); select.execute(); } 43
  44. 44. // Free resources of select object. finally { select.close(); } } /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** * Returns an array of objects representing the rows in the result set. */ public DrugsByMfgRow[] getRows() { DrugsByMfgRow[] rows = new DrugsByMfgRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new DrugsByMfgRow(select, i + 1); }; return rows; } } 44
  45. 45. DrugsByMfgRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 8, 2004 1:32:08 AM */ public class DrugsByMfgRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public DrugsByMfgRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */ public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns the value of column BRAND_NAME_BRAND_DESCRIPTION in the row represented by this object. */ public Object getBRAND_NAME_BRAND_DESCRIPTION() throws SQLException { return select.getCacheValueAt(rowNumber, 2); } /** * Returns the value of column CORE_DESCRIPTION_OBSOLETE_DATE in the row represented by this object. */ public Object getCORE_DESCRIPTION_OBSOLETE_DATE() throws SQLException { return select.getCacheValueAt(rowNumber, 3); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 45
  46. 46. GetAdminLogonInfo.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 11:29:11 PM */ public class GetAdminLogonInfo { private DBSelect select; /** * Constructor for a DBSelect class. */ public GetAdminLogonInfo() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME LIKE :code AND IDS517TEAM2.ADMIN.USERID LIKE :id"); DBParameterMetaData parmMetaData = select.getParameterMetaData(); parmMetaData.setParameter( 1, "code", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 2, "id", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute(String userid, String password, String code, String id) throws SQLException { try { select.setUsername(userid); select.setPassword(password); select.setParameter("code", code); select.setParameter("id", id); select.execute(); } // Free resources of select object. finally 46
  47. 47. { select.close(); } } /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** * Returns an array of objects representing the rows in the result set. */ public GetAdminLogonInfoRow[] getRows() { GetAdminLogonInfoRow[] rows = new GetAdminLogonInfoRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new GetAdminLogonInfoRow(select, i + 1); }; return rows; } } 47
  48. 48. GetAdminLogonInfoRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 11:29:11 PM */ public class GetAdminLogonInfoRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public GetAdminLogonInfoRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column ADMIN_CODENAME in the row represented by this object. */ public Object getADMIN_CODENAME() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns the value of column ADMIN_USERID in the row represented by this object. */ public Object getADMIN_USERID() throws SQLException { return select.getCacheValueAt(rowNumber, 2); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 48
  49. 49. GetAnAdministrator.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 6:12:19 PM */ public class GetAnAdministrator { private DBSelect select; /** * Constructor for a DBSelect class. */ public GetAnAdministrator() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID, IDS517TEAM2.ADMIN.FIRSTNAME, IDS517TEAM2.ADMIN.LASTNAME, IDS517TEAM2.ADMIN.STREET, IDS517TEAM2.ADMIN.CITY, IDS517TEAM2.ADMIN.STATE, IDS517TEAM2.ADMIN.ZIP, IDS517TEAM2.ADMIN.PHONE FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME = :username AND IDS517TEAM2.ADMIN.USERID = :userid"); DBParameterMetaData parmMetaData = select.getParameterMetaData(); parmMetaData.setParameter( 1, "username", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 2, "userid", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute( String name, String password, String username, String userid) throws SQLException { try { select.setUsername(name); select.setPassword(password); 49
  50. 50. select.setParameter("username", username); select.setParameter("userid", userid); select.execute(); } // Free resources of select object. finally { select.close(); } } /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** * Returns an array of objects representing the rows in the result set. */ public GetAnAdministratorRow[] getRows() { GetAnAdministratorRow[] rows = new GetAnAdministratorRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new GetAnAdministratorRow(select, i + 1); }; return rows; } } 50
  51. 51. GetAnAdministratorRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 6:12:20 PM */ public class GetAnAdministratorRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public GetAnAdministratorRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column ADMIN_CODENAME in the row represented by this object. */ public Object getADMIN_CODENAME() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns the value of column ADMIN_USERID in the row represented by this object. */ public Object getADMIN_USERID() throws SQLException { return select.getCacheValueAt(rowNumber, 2); } /** * Returns the value of column ADMIN_FIRSTNAME in the row represented by this object. */ public Object getADMIN_FIRSTNAME() throws SQLException { return select.getCacheValueAt(rowNumber, 3); } /** * Returns the value of column ADMIN_LASTNAME in the row represented by this object. */ public Object getADMIN_LASTNAME() throws SQLException { return select.getCacheValueAt(rowNumber, 4); } /** * Returns the value of column ADMIN_STREET in the row represented by this object. */ public Object getADMIN_STREET() throws SQLException { return select.getCacheValueAt(rowNumber, 5); } /** * Returns the value of column ADMIN_CITY in the row represented by this object. */ public Object getADMIN_CITY() throws SQLException { return select.getCacheValueAt(rowNumber, 6); } /** * Returns the value of column ADMIN_STATE in the row represented by this object. */ 51
  52. 52. public Object getADMIN_STATE() throws SQLException { return select.getCacheValueAt(rowNumber, 7); } /** * Returns the value of column ADMIN_ZIP in the row represented by this object. */ public Object getADMIN_ZIP() throws SQLException { return select.getCacheValueAt(rowNumber, 8); } /** * Returns the value of column ADMIN_PHONE in the row represented by this object. */ public Object getADMIN_PHONE() throws SQLException { return select.getCacheValueAt(rowNumber, 9); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 52
  53. 53. GetMfgRowFromCode.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 11:48:11 AM */ public class GetMfgRowFromCode { private DBSelect select; /** * Constructor for a DBSelect class. */ public GetMfgRowFromCode() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_ID, IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.DRUG_SOURCE.ADDRESS, IDS517TEAM2.DRUG_SOURCE.CITY, IDS517TEAM2.DRUG_SOURCE.STATE, IDS517TEAM2.DRUG_SOURCE.ZIP, IDS517TEAM2.DRUG_SOURCE.URL FROM IDS517TEAM2.DRUG_SOURCE WHERE IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = :id"); DBParameterMetaData parmMetaData = select.getParameterMetaData(); parmMetaData.setParameter( 1, "id", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.SMALLINT, Short.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute(String userid, String password, Short id) throws SQLException { try { select.setUsername(userid); select.setPassword(password); select.setParameter("id", id); select.execute(); } // Free resources of select object. finally { select.close(); } } 53
  54. 54. /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** * Returns an array of objects representing the rows in the result set. */ public GetMfgRowFromCodeRow[] getRows() { GetMfgRowFromCodeRow[] rows = new GetMfgRowFromCodeRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new GetMfgRowFromCodeRow(select, i + 1); }; return rows; } } 54
  55. 55. GetMfgRowFromCodeRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 11:48:11 AM */ public class GetMfgRowFromCodeRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public GetMfgRowFromCodeRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column DRUG_SOURCE_SOURCE_ID in the row represented by this object. */ public Object getDRUG_SOURCE_SOURCE_ID() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */ public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException { return select.getCacheValueAt(rowNumber, 2); } /** * Returns the value of column DRUG_SOURCE_ADDRESS in the row represented by this object. */ public Object getDRUG_SOURCE_ADDRESS() throws SQLException { return select.getCacheValueAt(rowNumber, 3); } /** * Returns the value of column DRUG_SOURCE_CITY in the row represented by this object. */ public Object getDRUG_SOURCE_CITY() throws SQLException { return select.getCacheValueAt(rowNumber, 4); } /** * Returns the value of column DRUG_SOURCE_STATE in the row represented by this object. */ public Object getDRUG_SOURCE_STATE() throws SQLException { return select.getCacheValueAt(rowNumber, 5); } /** * Returns the value of column DRUG_SOURCE_ZIP in the row represented by this object. */ public Object getDRUG_SOURCE_ZIP() throws SQLException { return select.getCacheValueAt(rowNumber, 6); } /** * Returns the value of column DRUG_SOURCE_URL in the row represented by this object. */ 55
  56. 56. public Object getDRUG_SOURCE_URL() throws SQLException { return select.getCacheValueAt(rowNumber, 7); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 56
  57. 57. GetMfgRowFromCodeRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 11:48:11 AM */ public class GetMfgRowFromCodeRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public GetMfgRowFromCodeRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column DRUG_SOURCE_SOURCE_ID in the row represented by this object. */ public Object getDRUG_SOURCE_SOURCE_ID() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */ public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException { return select.getCacheValueAt(rowNumber, 2); } /** * Returns the value of column DRUG_SOURCE_ADDRESS in the row represented by this object. */ public Object getDRUG_SOURCE_ADDRESS() throws SQLException { return select.getCacheValueAt(rowNumber, 3); } /** * Returns the value of column DRUG_SOURCE_CITY in the row represented by this object. */ public Object getDRUG_SOURCE_CITY() throws SQLException { return select.getCacheValueAt(rowNumber, 4); } /** * Returns the value of column DRUG_SOURCE_STATE in the row represented by this object. */ public Object getDRUG_SOURCE_STATE() throws SQLException { return select.getCacheValueAt(rowNumber, 5); } /** * Returns the value of column DRUG_SOURCE_ZIP in the row represented by this object. */ public Object getDRUG_SOURCE_ZIP() throws SQLException { return select.getCacheValueAt(rowNumber, 6); } /** * Returns the value of column DRUG_SOURCE_URL in the row represented by this object. */ 57
  58. 58. public Object getDRUG_SOURCE_URL() throws SQLException { return select.getCacheValueAt(rowNumber, 7); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 58
  59. 59. GetNextMfgSourceId.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 1:35:29 AM */ public class GetNextMfgSourceId { private DBSelect select; /** * Constructor for a DBSelect class. */ public GetNextMfgSourceId() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT (MAX(IDS517TEAM2.DRUG_SOURCE.SOURCE_ID) + 1) FROM IDS517TEAM2.DRUG_SOURCE"); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute(String userid, String password) throws SQLException { try { select.setUsername(userid); select.setPassword(password); select.execute(); } // Free resources of select object. finally { select.close(); } } /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** * Returns an array of objects representing the rows in the result set. */ public GetNextMfgSourceIdRow[] getRows() 59
  60. 60. { GetNextMfgSourceIdRow[] rows = new GetNextMfgSourceIdRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new GetNextMfgSourceIdRow(select, i + 1); }; return rows; } } 60
  61. 61. GetNextMfgSourceIdRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 1:35:30 AM */ public class GetNextMfgSourceIdRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public GetNextMfgSourceIdRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column ColExp1 in the row represented by this object. */ public Object getColExp1() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 61
  62. 62. Global.java /* * Created on Jan 7, 2004 * * To change the template for this generated file go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ package drug; /** * @author GLANCE * * To change the template for this generated type comment go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ public interface Global { // Uncomment when using CBA computer static String USERNAME = "ids517team2"; static String PASSWORD = "glance44"; // Uncomment when using Gary's home computer // static String USERNAME = "glance"; // static String PASSWORD = "gl122855"; } 62
  63. 63. IngredientListForBrandNamesLike.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 3:25:15 PM */ public class IngredientListForBrandNamesLike { private DBSelect select; /** * Constructor for a DBSelect class. */ public IngredientListForBrandNamesLike() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT DISTINCT X.DRUG_NAME, A.ACTIVE_INGREDIENT FROM IDS517TEAM2.ACTIVE_INGREDIENT AS A, IDS517TEAM2.ACTIVE_INGREDIENT_LIST AS I, IDS517TEAM2.DRUG_CODE AS D, IDS517TEAM2.DRUG_ID AS X WHERE A.ACTIVE_INGREDIENT_CODE = I.ACTIVE_INGREDIENT_CODE AND I.DRUG_CODE = D.DRUG_CODE AND D.DRUG_ID = X.DRUG_ID AND A.ACTIVE_INGREDIENT_CODE IN ( SELECT L.ACTIVE_INGREDIENT_CODE FROM IDS517TEAM2.ACTIVE_INGREDIENT_LIST AS L WHERE L.DRUG_CODE IN ( SELECT C.DRUG_CODE FROM IDS517TEAM2.DRUG_ID AS B, IDS517TEAM2.DRUG_CODE AS C WHERE B.DRUG_ID = C.DRUG_ID AND B.DRUG_NAME LIKE :name1 ) ) AND X.DRUG_NAME LIKE :name2"); DBParameterMetaData parmMetaData = select.getParameterMetaData(); parmMetaData.setParameter( 1, "name1", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 2, "name2", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute(String userid, String password, String name1, String name2) throws SQLException { try { select.setUsername(userid); select.setPassword(password); 63
  64. 64. select.setParameter("name1", name1); select.setParameter("name2", name2); select.execute(); } // Free resources of select object. finally { select.close(); } } /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** * Returns an array of objects representing the rows in the result set. */ public IngredientListForBrandNamesLikeRow[] getRows() { IngredientListForBrandNamesLikeRow[] rows = new IngredientListForBrandNamesLikeRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new IngredientListForBrandNamesLikeRow(select, i + 1); }; return rows; } } 64
  65. 65. IngredientListForBrandNamesLikeRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 3:25:16 PM */ public class IngredientListForBrandNamesLikeRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public IngredientListForBrandNamesLikeRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column X_DRUG_NAME in the row represented by this object. */ public Object getX_DRUG_NAME() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns the value of column A_ACTIVE_INGREDIENT in the row represented by this object. */ public Object getA_ACTIVE_INGREDIENT() throws SQLException { return select.getCacheValueAt(rowNumber, 2); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 65
  66. 66. InsertAdmin.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBModify property values. It also provides * methods that execute your SQL statement and return * a DBModify reference. * Generated: Jan 7, 2004 8:16:39 AM */ public class InsertAdmin { private DBModify modify; /** * Constructor for a DBModify class. */ public InsertAdmin() { super(); initializer(); } /** * Creates a DBModify instance and initializes its properties. */ protected void initializer() { modify = new DBModify(); try { modify.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); modify.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); modify.setCommand( "INSERT INTO IDS517TEAM2.ADMIN ( CODENAME, USERID, FIRSTNAME, LASTNAME, STREET, CITY, STATE, ZIP, PHONE ) VALUES ( :codename, :userid, :firstname, :lastname, :street, :city, :state, :zip, :phone )"); DBParameterMetaData parmMetaData = modify.getParameterMetaData(); parmMetaData.setParameter( 1, "codename", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 2, "userid", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 3, "firstname", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 4, "lastname", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 5, "street", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 6, "city", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); 66
  67. 67. parmMetaData.setParameter( 7, "state", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 8, "zip", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 9, "phone", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute( String username, String password, String codename, String userid, String firstname, String lastname, String street, String city, String state, String zip, String phone) throws SQLException { try { modify.setUsername(username); modify.setPassword(password); modify.setParameter("codename", codename); modify.setParameter("userid", userid); modify.setParameter("firstname", firstname); modify.setParameter("lastname", lastname); modify.setParameter("street", street); modify.setParameter("city", city); modify.setParameter("state", state); modify.setParameter("zip", zip); modify.setParameter("phone", phone); modify.execute(); } // Free resources of modify object. finally { modify.close(); } } /** * Returns a DBModify reference. */ public DBModify getDBModify() { return modify; } } 67
  68. 68. InsertVendor.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBModify property values. It also provides * methods that execute your SQL statement and return * a DBModify reference. * Generated: Jan 7, 2004 1:24:17 AM */ public class InsertVendor { private DBModify modify; /** * Constructor for a DBModify class. */ public InsertVendor() { super(); initializer(); } /** * Creates a DBModify instance and initializes its properties. */ protected void initializer() { modify = new DBModify(); try { modify.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); modify.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); modify.setCommand( "INSERT INTO IDS517TEAM2.DRUG_SOURCE ( SOURCE_ID, SOURCE_DESC, ADDRESS, CITY, STATE, ZIP, URL ) VALUES ( :id, :descr, :address, :city, :state, :zip, :url )"); DBParameterMetaData parmMetaData = modify.getParameterMetaData(); parmMetaData.setParameter( 1, "id", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.SMALLINT, Short.class); parmMetaData.setParameter( 2, "descr", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 3, "address", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 4, "city", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 5, "state", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 6, "zip", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); parmMetaData.setParameter( 68
  69. 69. 7, "url", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute( String userid, String password, Short id, String descr, String address, String city, String state, String zip, String url) throws SQLException { try { modify.setUsername(userid); modify.setPassword(password); modify.setParameter("id", id); modify.setParameter("descr", descr); modify.setParameter("address", address); modify.setParameter("city", city); modify.setParameter("state", state); modify.setParameter("zip", zip); modify.setParameter("url", url); modify.execute(); } // Free resources of modify object. finally { modify.close(); } } /** * Returns a DBModify reference. */ public DBModify getDBModify() { return modify; } } 69
  70. 70. SelectAllBrands.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 3:03:51 AM */ public class SelectAllBrands { private DBSelect select; /** * Constructor for a DBSelect class. */ public SelectAllBrands() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME"); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute(String userid, String password, int maxRows) throws SQLException { try { select.setUsername(userid); select.setPassword(password); select.setMaxRows(maxRows); select.execute(); } // Free resources of select object. finally { select.close(); } } /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** 70
  71. 71. * Returns an array of objects representing the rows in the result set. */ public SelectAllBrandsRow[] getRows() { SelectAllBrandsRow[] rows = new SelectAllBrandsRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new SelectAllBrandsRow(select, i + 1); }; return rows; } } 71
  72. 72. SelectAllBrandsLike.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 2:20:26 AM */ public class SelectAllBrandsLike { private DBSelect select; /** * Constructor for a DBSelect class. */ public SelectAllBrandsLike() { super(); initializer(); } /** * Creates a DBSelect instance and initializes its properties. */ protected void initializer() { select = new DBSelect(); try { select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver"); select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE"); select.setCommand( "SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME WHERE IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION LIKE :brand"); DBParameterMetaData parmMetaData = select.getParameterMetaData(); parmMetaData.setParameter( 1, "brand", java.sql.DatabaseMetaData.procedureColumnIn, java.sql.Types.VARCHAR, String.class); } catch (SQLException ex) { ex.printStackTrace(); } } /** * Executes the SQL statement. */ public void execute( String userid, String password, int maxRows, String brand) throws SQLException { try { select.setUsername(userid); select.setPassword(password); select.setMaxRows(maxRows); select.setParameter("brand", brand); select.execute(); } // Free resources of select object. finally { 72
  73. 73. select.close(); } } /** * Returns a DBSelect reference. */ public DBSelect getDBSelect() { return select; } /** * Returns an array of objects representing the rows in the result set. */ public SelectAllBrandsLikeRow[] getRows() { SelectAllBrandsLikeRow[] rows = new SelectAllBrandsLikeRow[select.getRowCount()]; for (int i = 0; i <= select.getRowCount() - 1; i++) { rows[i] = new SelectAllBrandsLikeRow(select, i + 1); }; return rows; } } 73
  74. 74. SelectAllBrandsLikeRow.java package drug; import java.sql.*; import com.ibm.db.beans.*; /** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 2:20:26 AM */ public class SelectAllBrandsLikeRow { private int rowNumber; private DBSelect select; /** * Constructs an object that represents a row from a DBSelect. */ public SelectAllBrandsLikeRow(DBSelect aRef, int aRowNumber) { select = aRef; rowNumber = aRowNumber; } /** * Returns the value of column BRAND_NAME_BRAND_CODE in the row represented by this object. */ public Object getBRAND_NAME_BRAND_CODE() throws SQLException { return select.getCacheValueAt(rowNumber, 1); } /** * Returns the value of column BRAND_NAME_BRAND_DESCRIPTION in the row represented by this object. */ public Object getBRAND_NAME_BRAND_DESCRIPTION() throws SQLException { return select.getCacheValueAt(rowNumber, 2); } /** * Returns a String that contains all of the values in the row represented by this object. */ public String toString() { String string = ""; try { for (int i = 1; i <= select.getColumnCount(); i++) { string += select.getCacheValueAt(rowNumber, i); string += " "; } } catch (SQLException ex) { return null; } return string; } } 74

×