java2db

JDBC with Oracle in MyEclipse and NetBeans



JDBC application programming interface is one of the best and easiest  ways to interact with the database.Explained  JDBC with Oracle using MyEclipse and NetBeans in a simple and detailed way.

 

Basic requirements to run the application
Softwares MyEclipse or NetBeans IDE   (Download MyEclipse , Download NetBeans )
Oracle    (Download Oracle )
java       (Download java )
Note :Better to use latest versions
Jar Files ojdbc14.jar
Files .java or .class

 

JDBC is a specification from Sun Microsystems and provides a standard abstraction in the form APIs  of protocols for java applications to communicate with different relational databases . Below example , used type-4 driver to connect with the database.

 

JDBC With Oracle In MyEclipse :

Create New Project : 

Go to File > New  and select Java Project

JDBC with Oracle

 

Enter valid  name of the project in the popup window , click Finish button.

JDBC with Oracle

The new project  created in the top-left corner of the MyEclipse IDE .

 

Add Jar Files :

Right click on the project , select Build Path -> Configure Build Path sub menu .

JDBC with Oracle

Click Add External JARs and select the ojdbc14.jar from the existing location. Click OK

JDBC with Oracle

 

Project Directory Structure :

This diagram represents the project directory structure .

 

 JDBC with Oracle example code :

Copy and save the below code in jdbcTestApp.java  file

To run the application , right click on the project  and select Run As -> Java Application.

 

JDBC With Oracle In NetBeans :

Create New Project :

Go to File , select New Project sub menu

JDBC with Oracle

From Java select Java Application

JDBC with Oracle

Enter appropriate project name in the Project Name box , click Finish.

Add Jar Files : 

Expand project , Right click on Libraries and select Add JAR/Folder

Select ojdbc14.jar for the location where it reside and finally click open .

Project Directory Structure :

See the project  directory structure in the  top-left side of the NetBeans IDE. It should be like below.

JDBC with Oracle example : 

Copy and save the below code in jdbcTestApp.java  file

Right click on the project and select  Run .




Related Posts :
How to Connect to Oracle from Liferay portlet ( Java Liferay and Oracle integration )
Call database in Jsp (Access Oracle , MySQL , PostgerSQL ,Db2 from Jsp)
Jsp , Servlet and JDBC login application example in NetBeans
Jsp,Servlet and JDBC integration example in Eclipse
Connect DB2 with Hibernate 4 in MyEclipse,NetBeans,RAD
Connect PostgreSQL with Hibernate 4 in Myeclipse,NetBeans,RAD
Connect MySQL with Hibernate 4 in NetBeans,MyEclipse,RAD
Connect oracle with hibernate in MyEclipse, NetBeans, RAD
   [will not be published]



^ <