Using Oracle on Acme
Here are some brief instructions about how you can use Oracle on acme.
First there are some simple instructions for connecting to Oracle using
sqlplus
which is the command-line interface to Oracle. This is followed by some
sample code to help you write your own Pro*C programs.
Using sqlplus
Steps to use sqlplus are:
-
Connect to acme
-
Run the script oraenv with the following command
{acmeb:gte585q:!} . oraenv
ORACLE_SID = [gte585q] ? ccdb
(The 'ccdb' stands for students who are taking CS4400 -- it is the
database that OIT gives access to CoC students)
-
Now you will be able to run sqlplus with the following command:
{acmeb:gte585q:!} sqlplus
Once sqlplus starts up, it should show you the following message:
SQL*Plus: Release 8.1.7.0.0 - Production on Thu Jan 24 11:32:18 2002
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Enter user-name:
type in your gt account in prism, your initial password is gtxxxxxDDMM.
gtxxxxx is your account in prism, and DDMM is day and
month of you birthday. After login, you will see:
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
With the Partitioning option
JServer Release 8.1.7.0.0 - Production
SQL>
You'd better modify your password now, by typing in:
SQL>password
Answer your old password and set new password.
Now, you should be able to run your SQL commands at this prompt. Remember
the following rules:
-
Always terminate your commands with a semi-colon.
-
Exit sqlplus by entering quit or exit at the SQL>
prompt
Writing Pro*C programs
What is Pro*C? Pro*C is the Oracle pre-compiler for the C programming language.
It allows you to write embedded SQL statements in your C program -- which
is supposed to make it easier to write database programs. The way your
program is written is shown below:
-
First follow the steps shown above for SQL Plus.
-
Then, if your program is called 'sample.pc', you can compile it
on acmeb by running:
make -f proc.mk EXE=sample OBJS="sample.o"
You can also compile multiple .c files into an executable by specifying
them in the OBJS section.
make -f proc.mk EXE=sample OBJS="sample1.o
sample2.o sample3.o"
Here are links to the makefile proc.mk and to a sample
Pro*C program
Last Modified: 1/24/2002 by Keke Chen