May 31, 2010

Java-Oracle Connectivity

Hi All,

This post shows how to do JDBC [Java Database Connectivity] in Java. It was long time pending but today only I could recall it of posting it. My Apologies for it.


STEP 2: Add ojdbc14.jar to the build path of your project.

STEP 3: Create a Java Program JDBCConnectDemo.java like following


In above program, 
URL= Connection String including HOSTNAME, PORT NO, SID.
DRIVER = Name of the driver used. 

In above case OracleDriver is used. You can connect to any other driver also in similar way.
Username = username used to connect to the database
Password = password used to connect to the database

STEP 4: Output like following will be shown when above program will be run

[ SRC: Java-Oracle Connectivity ]

Feel free to ask questions if any ! :)