Monday, December 8, 2014

How to add oracle DB connection in Eclipse

Have a DB connection in Eclipse will be very helpful if you need use persistence frameworks like Hibernate or JPA.  It's normally a prerequisite for other functions, for example let eclipse create java entities class from database tables automatically.  Here's how to configure oracle connection in Eclipse.

1. what you need

  • Oracle JDBC driver. ( A jar file may look like ojdbcxxx.jar, if you don't have it on your local file system, download it from oracle website)

2. open "Data Source Explorer" view in Eclipse

From menu, select "window"->"Show View"->"Other"

Snap_2014.12.09 11.23.04_014

Next, Choose "Data Source Explorer" from category "Data Management"

Snap_2014.12.09 10.04.24_002

Then you should have the view opened.

3. Add new connection

Right click on the "Database Connection" in the "Data Source Explorer" view we just opened.  choose "New..."

Snap_2014.12.09 10.06.49_003 

Choose database type ( here is Oracle), give a name for this connection (here is "oracle")

Snap_2014.12.09 10.08.52_005

Next, select the oracle driver for this connection by click the follow icon pointed by the arrow.

Snap_2014.12.09 10.13.26_006

Next, choose oracle version (I'm using oracle 11 for this demo, you can pick up your version) ,  and click the "Jar List" tab to set the driver file path

Snap_2014.12.09 10.14.51_007

In the "Jar List" tab, replace the default non-exists oracle driver file, which is ojdbc14.jar, with the real one  in you local file system, which is d:\ojdbc6.jar

Snap_2014.12.09 10.17.27_009

Snap_2014.12.09 10.19.15_010 

Close the above window,  next provide connection information.

Snap_2014.12.09 10.22.01_012

Use "Test Connection" button to make sure every thing is OK, then Finish.

4. After Connection created

You can see the new oracle DB connection appears in the "Data Source Explorer" view.

Snap_2014.12.09 11.50.04_015

You can browse the database in the view within Eclipse.


  1. Works for me too. Thanks!
    It could be useful just to explain "SID" property.

  2. after doing all this it shows ping failed msg how we can resolve it

  3. I am using informix, and version 12 is not shown I can do?

  4. Nice article, worked for me as well

  5. In drivers tab, i can't see any specified drivers

  6. Doesn't this driver definition need to know where my ORACLE_HOME is? How does it know how to translate the SID? We use ldap here and it's defined very nicely in the usual place in the ORACLE_HOME/network/admin.

    Or does the jdbc driver not need it?

    I feel I'm missing a significant piece of information....

  7. I have connected but it is not showing any tables in schema

  8. I am unable to find data management view in my eclipse window.
    I cannot find it in the perspective window too .
    What do I do?please solve my query.

  9. it is showing ping failed msg how we can resolve it by cheking jar file

  10. While adding the JPA Facet, in "specify a driver and connection details" the drivers drop down list is empty. Also when I go to "new driver definition", I get all wizard with all the sections grayed out(like add zars etc) and an empty jar list.


Powered by Blogger.

About The Author

My Photo

Has been a senior software developer, project manager for 10+ years. Dedicate himself to Alcatel-Lucent and China Telecom for delivering software solutions.


Unordered List