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"
Next, Choose "Data Source Explorer" from category "Data Management"
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..."
Choose database type ( here is Oracle), give a name for this connection (here is "oracle")
Next, select the oracle driver for this connection by click the follow icon pointed by the arrow.
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
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
Close the above window, next provide connection information.
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.
You can browse the database in the view within Eclipse.
Thanks! Worked for me.
ReplyDeleteWorks for me too. Thanks!
ReplyDeleteIt could be useful just to explain "SID" property.
after doing all this it shows ping failed msg how we can resolve it
ReplyDeleteCheck your jar file.
DeleteI am using informix, and version 12 is not shown I can do?
ReplyDeleteNice article, worked for me as well
ReplyDeleteIn drivers tab, i can't see any specified drivers
ReplyDeleteDoesn'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.
ReplyDeleteOr does the jdbc driver not need it?
I feel I'm missing a significant piece of information....
I have connected but it is not showing any tables in schema
ReplyDeleteI am unable to find data management view in my eclipse window.
ReplyDeleteI cannot find it in the perspective window too .
What do I do?please solve my query.
it is showing ping failed msg how we can resolve it by cheking jar file
ReplyDeleteThanks, Shashikanth
ReplyDeleteWhile 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.
ReplyDelete