Using Oracle

From Courses

Jump to: navigation, search

Contents

[edit] Running SQL or PL/SQL Programs using SQLPlus

[edit] From a Unix terminal in one of the lab1-* machines in the CADE lab

  • Run: source /home/claudios/oracle/oraenv.csh
  • Invoke: sqlplus yourlogin/yourpassword@yellow/orcl
  • Note: If you install an Oracle client on your own Linux machine, you can use the following tnsnames.ora file
  • If you would prefer this environment to always be present when you log in to the cade machines, you can modify the contents of your ~/.cshrc file so that this environment is set up every time you log in.

[edit] Remember to change your password

Using sqlplus on a Unix terminal, at the SQLPlus command prompt type the password command. You will be prompted to enter you old password followed by your new password.


You can also, at the SQLPlus command prompt, issue the following command:

alter user <user_name> identified by <new_password>;

[edit] Getting Started with JDBC

Below is a simple program that illustrates how you can connect to Oracle from a Java program. To run this program, login to one of the lab1-* machines (e.g., lab4-1.eng.utah.edu):

  • source /home/freire/oracle/oraenv.csh
  • At the sqlplus prompt, run the students.sql script to set up the sample database, you can do that by typing the following at the prompt:
  @students.sql

(assuming students.sql is in the current directory, otherwise, use the full path for the file)

You will have to edit this file and add your Oracle login and password. If you don't, you will get the following error: java.sql.SQLException: ORA-12547: TNS:lost contact

  • java OracleTest

[edit] Oracle Documentation

Comprehensive documentation is available on Oracle features at http://www.oracle.com/technology/documentation/index.html.


[edit] Oracle 11g Users

Oracle 11g has its own user registry, authentication, and privilege system. The CS 5530 / 6530 course staff have database administrator control, and can resolve any access or privilege problems you may have. Report any problems to teach-cs5530 [at] list [dot] eng [dot] utah [dot] edu.

[edit] Oracle SQL Dialect

See this link for a discussion of how Oracle SQL differs from that in our textbook.

Personal tools