Spring 2004 / Sections 3 & 4
Last generated: Thu Apr 15 22:20:22 2004 EST.
- Trigger example script in DB2 notation.
- Download the following two SQL scripts into your UNIX account:
company_schema.sql (script to create example schema) and company_data.sql (script to populate example data). Open two files using PICO, and change the first line's "dul13" to your PSU ID. Then, run the following:
If you already have any of the following tables in DB2 -- employee, dept,
item, parts, supply, sale, debit, city, store, supplier -- then, you
will get an error. In that case, drop the table first (eg, DROP TABLE
foo), and re-run. At the end, make sure you have all the necessary
schema/data successfully created in DB2 by running:
- Unix prompt% db2 -tf company_schema.sql
- Unix prompt% db2 -tf company_data.sql
- db2 => list
- .cshrc: Download this and store it in your CAC home directory.
- When you send a DB2-related question to ITS at PSU, use firstname.lastname@example.org with a copy to TA or instructor.
- How to use SSH client to connect DB2 at CAC Unix machines
- How to create tables and add values in DB2
- How to run SQL commands stored in a file in DB2
- Full DB2 Documentation
- DB2 SQL Commands HELP
- You can access your PHP file at: http://phpdb.aset.psu.edu/phpdul13/test.php, where replace "dul13" by your PSU ID, of course.
- PHP basic presentation
- test.php: PHP test
- form.php: HTML FORM example
- db-simple.php: PHP example for simple database access
- db.php: PHP example for database access using FORM inputs and error handling (DSN=dul13, ID=dul13, Password=mypassword), where change dul13 to your PSU ID
- db2.php: PHP example for database access using FORM inputs and display results by iteration