The following OCI sample programs are available in the quickstart/sample_code/oci directory.
|addemp.c||This is an OCI program that prompts the users for information and inserts the corresponding data into a new employee into the EMP table.
You are prompted for the username and password at runtime.
The ‘servicename’ can be either an entry in the TNSnames.ora file or an easy connect string.
The EMP table needs to exist for this program to work.
sample program uses OCI to access common PL/SQL packages (emp_pkg and sample_pkg) in four different ways:
- Calls a stored procedure with IN and OUT parameters
- Calls a stored function with IN and OUT parameters
- Calls an anonymous block and passes host variables into and out of the block
- Calls a store procedure to open a ref cursor and uses OCI to process the result-set of the ref cursor
The EMP table and the emp_pkg and sample_pkg PL/SQL packages need to exist for this program to work.
|tptbmOCI.c||This program implements a multi-user throughput benchmark. By default, the transaction mix consists of 80% SELECT (read) transactions and 20% UPDATE (write) transactions. In addition to SELECTs and UPDATEs, INSERTs and DELETES can also be included in the transaction mix. The ratio of SELECTs, UPDATEs and INSERTs and DELETES is specified at the command line. Each transaction consists of one or more SQL operations.
The benchmark initially populates the data store, and then executes the transaction mix on it. The number of rows inserted as part of the transaction mix cannot exceed the number of rows with which the database is populated initially.
The measurement error for the benchmark is at most 2 seconds. This will be negligible at loads with a duration in excess of 200 seconds. A suggested load for the benchmark is one which lasts at least 600 seconds.
The schema for this test is described in the program source file tptbmOCI.c.
Compile and Run
Click here to learn how to compile and run the sample programs on your installed platform.