eHow launches Android app: Get the best of eHow on the go.

How To

How to Connect to a Oracle Database in Java

Member
By Kristin Bauer
User-Submitted Article
(1 Ratings)

This article is a step-by-step guide for connecting to an oracle database using Java.

Difficulty: Moderately Easy
Instructions

Things You'll Need:

  • Java IDE such as NetBeans
  • Oracle Drivers
  • Java code
  1. Step 1

    Install a Java IDE such as NetBeans.

  2. Step 2

    Download JDBC drivers for the oracle database version you are connecting to. These are available at the link below.
    Depending on your database, the file should be named something like ojdbc14.jar or classes12.zip.

  3. Step 3

    Move the driver files to the following folder: C:\Program Files\Java\jdk1.6.0\jre\lib\ext. (or the folder corresponding to the Java version that you have installed). Attempt to connect using the Java code below and if you have successfully connected to the database, you can skip Step 4.

  4. Step 4

    Add the JDBC drivers to your project library. If you are using NetBeans, go to Tools->Java Platforms and on the source tab, add the drivers. Next, you should right click on your project and go to Properties->Libraries and add the drivers in the compile and run tabs.

  5. Step 5

    The Java code samples linked below can be used to connect to your oracle database. The same code may be used for reading or writing to a database, just change the sql statement.

Tips & Warnings
  • Be sure to use the correct driver files for the database version that you are trying to connect to.
  • Be sure that your drivers are compatible with the Java version that you are using.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

eHow Computers
eHow_eHow Technology and Electronics