top of page
Writer's pictureThe Tech Platform

How to connect Eclipse to Oracle Database

Updated: Mar 27, 2023

Eclipse is a popular integrated development environment (IDE) used by developers for various programming languages such as Java, Python, C++, and others. It also offers a convenient way to connect to different databases including Oracle Database. In this article, we will explain the steps to connect Eclipse to an Oracle Database in detail.


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 the 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.


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 databases and installing Oracle JDBC driver instead of SQL Server JDBC driver.


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

  1. Open Eclipse IDE and Select Database Perspective

  2. Create a Connection Profile, choose Oracle

  3. Choose JDBC Driver and specify its location

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

  5. Test Connection

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

For creating a new connection profile, select the "Database Connection" at the top left in the Database Development view, right click and select "New Connection". This will open the New Connection Profile window as shown below. Now type Oracle and give your connection profile a meaningful name e.g. combination of application, host, and instance.



Step 3: Choose JDBC Driver and specify its location

Once you have selected the database, it's time to select the JDBC driver. To configure JDBC driver, just click the setting icon on the previous screen as shown below:



After that, the following screen will open which will list down all JDBC drivers for supported Oracle versions e.g. Oracle 10g, Oracle 11g, and JDBC thin driver or other drivers. I have chosen the Oracle Thin Driver to connect Oracle 11g as seen below:



Once you select a particular driver, you can see the error message appear at the top saying "Unable to locate JAR/ZIP in the file system as specified by the driver definition: ojdbc14.jar", this means you need to locate the path of this JAR in your local file system, as shown below. If you don't specify the correct JAR, you will get "java.lang.classnotfoundexception oracle.jdbc.driver.oracledriver" error.


Once you are done, click Ok and then it will take you to the previous screen. Click next there.



Step 4: Specify Database Connection details

Now, it's time to specify the database connection details e.g. host, port, sid, username, and password required to connect to an Oracle database instance.




Step 5: Test Connection

Once you are done with putting connect detail, just click the "Test Connection" button, if everything is good then you will see a ping succeed message, if not then you will see a "ping failed" message.


Conclusion:

Connecting Eclipse to an Oracle Database is a straightforward process. By following the steps outlined in this article, you can quickly set up a connection between Eclipse and your Oracle database and start developing database applications.

0 comments

Comments


bottom of page