How to connect Eclipse to Oracle Database

In order to connect to Oracle database instance, you need two things:

1) Eclipse IDE for Java EE developers, because that contains the database development plugin which doesn't come along with Eclipse IDE for Java developers. You can download the latest version of Eclipse IDE for Java EE developers here.

2) Oracle JDBC JAR, since Eclipse uses JDBC to connect to Oracle database it needs JDBC driver JAR for Oracle. You can use any type of JDBC driver, but I prefer Oracle JDBC thin driver e.g. ojdbc14.jar file to connect to Oracle 11g instance. If you don't have, you can download from here.

Once you have these two things, we are ready to connect to any local or remote Oracle database instance from Eclipse IDE. I am using Eclipse Java EE IDE for Web Developers, Version: Kepler Service Release 2.

Steps to connect Oracle database from Eclipse

The steps are exactly similar to what I have shown you before while connecting to Microsoft SQL Server from Eclipse IDE, here, the only difference is, this time, we are choosing Oracle from the list of database and installing Oracle JDBC driver instead of SQL Server JDBC driver.

Here are the exact steps to connect Oracle instance from Eclipse:

  1. Open Eclipse IDE and Select Database Perspective (Windows >> Open Perspective >> Other >> Database Development).

  2. Create Connection Profile, Chose Oracle

  3. Choose JDBC Driver and specify its location

  4. Specify connection detail e.g. host, port, username, and password

  5. Test Connection

Tips like this save a lot of time and improve productivity and that's why I have always said that good understanding of Eclipse IDE is must to become an expert Java J2EE developer and developer should spend some time to learn their tools e.g. Eclipse.

Now, let's see each step in little bit detail with screenshot if you are ready to connect to Oracle database from Eclipse, follow it along:

Step 1: Open Eclipse IDE and Select Database Perspective

In order to open the Database Development perspective go to Windows >> Open Perspective >> Other >> Database Development, as shown below:

Step 2: Create Connection Profile