CMSC 461 Database Management Systems |
Java / JDBC Setup |
UMBC GL machinesIn JdbcSample.java set the url to the following String url = "jdbc:oracle:thin:@oracle2.gl.umbc.edu:1521:GL";
From the shell run setenv CLASSPATH ".:/usr/local/oracle/product/9.2.0/jdbc/lib/ojdbc14.jar"
Compile javac JdbcSample.java
Run java JdbcSample oracle_userid oracle_pw
Eclipse and Oracle Express should both be installed and running on your own local machine.· DOWNLOAD / INSTALL · Eclipse IDE for Java Developers · Download and save ojdbc14.jar to your desktop
· Start up Oracle XE · Make sure you have installed Sample DBs
· In Eclipse · Create new java project · Import the JDBC driver into the project · File -> Import -> General -> File System · Press Next · Click Browse to locate the directory containing ojdbc14.jar · Select the directory in the left hand box · Select ojdbc14.jar from the list on the right · Check “Into folder:” · Click Browse · Select the project folder · Click Finish · In Package Explorer · Right-click on the Project · Select Properties · Select "Java Build Path" · Click on "Libraries" tab · Click on "Add Jars" · Expand the project · Select ojdbc14.jar · Click OK · Click OK · Create a new java class · Copy JdbcSample.java into it · Compile and run · Should display all the tables from the Sample DBs
|