COMP3150
ORACLE
Oracle database is installed
Connecting to Oracle server from Delta using jdbc
CS Oracle database server connections
JDBC Connection string
In the connection strings below, replace "userid" with your UWinID, and "password" with your campus password.
Code to test your connection:
import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;
class JDBCVersion
{
public static void main (String args[]) throws SQLException
{
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:userid/password@oracle.cs.uwindsor.ca:1521:cs01");
Connection conn = ods.getConnection();
// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData();
// gets driver info:
System.out.println("JDBC driver version is " + meta.getDriverVersion());
}
}
The classpath for the Oracle JDBC archive will vary depending on the operating system and which version of the Oracle client you installed. The classpath in the following commands are those required to compile and run from a terminal on cs.uwindsor.ca.
javac -classpath /usr/lib/oracle/12.1/client64/lib/ojdbc7.jar JDBCVersion.java java -classpath /usr/lib/oracle/12.1/client64/lib/ojdbc7.jar:. JDBCVersion
SQL*Plus