CISE Help & Resources
Oracle
Contents
- Oracle 9 Documentation
- Determining the Name of the Database Instance
- Using SQL*Plus on the Unix Command Line
- Using Oracle from CGI Scripts
- Using Oracle From Windows, or From Outside CISE
- Using JDBC with Oracle
- PHP and Oracle DB Connections
- Using Perl/DBI with Oracle
- Using Ruby/DBI with Oracle
- Using Embedded SQL and the Oracle Pro*C/C++ Compiler
Oracle Documentation
Note: to prevent copyright infringements, this documentation is only availble within the CISE network.
To read this outside of the CISE network, ssh into sand or rain and run
lynx http://www.cise.ufl.edu/help/database/oracle.shtml or w3m -F http://www.cise.ufl.edu/help/database/oracle.shtml
Determining the Name of the Database Instance
Currently, there is 1 Oracle database instance running in the CISE department, the 'orcl' instance.
- orcl
- This is the Oracle 11g database instance used for most class and research
projects beginning Summer 2009. This will be the instance most users will
sign up for.
For the most part the oracle 9i client will work with the new Oracle 11g database, but for a better experience, we do suggest using one of the Linux machines with the new oracle 11g client.
Using SQL*Plus on the Unix Command Line
In order to use the command line SQL*Plus utility, do the following:
% source /usr/local/etc/ora.csh % sqlplus <username>@<instance>
Where <username> is replaced with your CISE username, and <instance> is the name of the database instance you are using. You will be prompted for your password once you run the sqlplus command.
For all Oracle 9i accounts, use:
source /usr/local/etc/ora.csh sqlplus (username here)@orcl
Note that by sourcing that file, you are setting the $ORACLE_HOME environment variable in the shell, which gets used by all programs subsequently run in that shell.
Using Oracle from CGI Scripts
If you are running a program as a CGI script, you will not have a shell from which you can source the /usr/local/etc/ora.csh file. In this case, you will need to set the environment variable $ORACLE_HOME from within your program to the value
/usr/local/libexec/oracle-client
E.g., in perl, you would do the following:
$ENV{ORACLE_HOME} = '/usr/local/libexec/oracle-client';
Please see the appropriate documentation for any other language on how to set environment variables there.
Using Oracle From Windows, or From Outside CISE
If you're using an Oracle client and need to specify the paramters, use the following for Oracle 9i accounts:
Server : oracle.cise.ufl.edu SID : orcl Port : 1521
Using JDBC with Oracle
To use Oracle's JDBC on CISE Solaris machines, add the following to your CLASSPATH:
/usr/local/libexec/oracle-client/jdbc/lib/classes12.zip:.
You should then be able to use the Oracle java classes (oracle.sql.*, oracle.jdbc.*, etc) in your java programs.
A quick Java example using JDBC is available here. Additional examples and demos can be found in the JDBC demo directory at:
/usr/local/libexec/oracle-client/jdbc
PHP and Oracle DB Connections
php (/usr/local/bin/php) now supports Oracle. Please see the manual here. Oracle support is discussed here.
A quick PHP exmple using OCI8 is available here.
More info on PHP at CISE can be found at the CISE PHP page
Using Perl/DBI with Oracle
To use Oracle in Perl, use the DBD::Oracle module.
A short Perl example using DBI is here.
Using Ruby/DBI with Oracle
For anyone interested in using the Ruby language, there's also support for Oracle in Ruby on CISE systems, using a DBI module modelled after the perl DBI scheme:
DBI.connect("dbi:Oracle:classdb", "username", "password" ) { |dbh|
dbh.prepare("select * from mytable") { |sth|
sth.execute(tablespace)
sth.each { |row|
p row
}
}
}
Using Embedded SQL and the Oracle Pro*C/C++ Compiler
For those using embedded SQL, the documentation can be found in the Oracle documentation
Demos and a sample Makefile can be found in
/usr/local/libexec/oracle-client/precomp/demo/proc