Monday, 1 October 2012

Connect Oracle10x Database using JSP

// siddhu vydyabhushana // Leave a Comment
As per requesting am going to show how to connect Oracle10g using JSP.
Before u nedd to download and install it 

Download: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.html

using Above link first download and install it . after first configuration is needed,for that 

START----->My Computer----->Os Drive (C or D)-------> Programming Files-----

-->Oracle----->Product--->10.2.0.----->server----->Jdbc----->lib

copy the path as below

C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc.jar;.;

copy the above code and paste it in EnvironMent Variables


Goto Right Click on My Computer----->Properties------>Advanced System 

Settings------->Environment Variables-----> Find Path in System Variables the

and paste the above in path field if there is any path u use ; (Semicolon) to

differentiate

for eg:


D:\ProgramFiles\Java\jdk1.6.0\bin  ;

C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc.jar;.;





JSP CODE:

just for demo am showing this in further post i will give brief info....

Class.Forname:

               Class.forName("oracle.jdbc.driver.OracleDriver");

Connection: 
for creating connection b/w user and database in jsp we need to write this type of code ,we are getting connection for decvice driver for that we used 
DriverManager.getConnection

we are getting connection using URL:- jdbc:oracle:thin:@localhost:1521:XE

On installation we gave Username and Passwor d to Protect ur DB.




Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:15 21:XE","Username","Password");

0 comments:

Post a Comment