Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

JSP database connectivity

This is a discussion on JSP database connectivity within the JSP forums, part of the Web Development category; how conncet the oracle database by using JSP. Reteriving the data from database by using JSP....

Go Back   Geeks Talk > Web Development > JSP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

JSP JSP Related Issues and Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-14-2009
Junior Member
 
Join Date: Aug 2009
Location: Yanam,India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Madhulatha Laddika is on a distinguished road
Post JSP database connectivity

how conncet the oracle database by using JSP. Reteriving the data from database by using JSP.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-14-2009
Expert Member
 
Join Date: May 2009
Location: Bangalore
Posts: 984
Thanks: 155
Thanked 420 Times in 201 Posts
rijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nice
Re: JSP database connectivity

Quote:
Originally Posted by Madhulatha Laddika View Post
how conncet the oracle database by using JSP. Reteriving the data from database by using JSP.
Hi Madhulatha Laddika,

What type of connection are you planning to use?
e.g. Pool Connecion or Driver Connection.
Pool Connection is via the Web Server while Driver Connection is using calling the database via the respective database JDBC Drivers.

Code:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( database ,"","");

Thanks,
Riju.

Last edited by rijus; 09-14-2009 at 11:54 AM.
Reply With Quote
  #3 (permalink)  
Old 4 Weeks Ago
Junior Member
 
Join Date: Oct 2008
Location: kolkata
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ajayasahoo108 is on a distinguished road
Re: JSP database connectivity

import java.io.*;
import java.sql.*;

public class OraThin {
public static void main(String[] args) {
try {
Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection(
"jdbcracle:thin:@machine_name:1521:database_name",
"scott",
"tiger");
Statement s=con.createStatement();
s.execute("
INSERT INTO BOOKS VALUES
(
'A Tale of Two Cities',
'William Shakespeare',
4567891231,
'5-JAN-1962'
)
");
s.close();
con.close();
} catch(Exception e){e.printStackTrace();}
}
}
Reply With Quote
  #4 (permalink)  
Old 4 Weeks Ago
Junior Member
 
Join Date: Dec 2008
Location: Indore MP India
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
amit.jain10 is on a distinguished road
Re: JSP database connectivity

mport java.io.*;
import java.sql.*;

public class ConnectionManager {

public Connection getConnection {
try {
Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection(
"jdbcracle:thin:@machine_nameort:database_name","username","password");
return con;
} catch(Exception e){e.printStackTrace();}
}
}

This class return the connection with oracle db. so make a onject of this class and call a getConnection method and take connection like...
ConnectionManager cm = new ConnectionManager();
Connection con=cm.getConnection();

Thx
Amit Jain
Reply With Quote
Reply

  Geeks Talk > Web Development > JSP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Does PHP support all database connectivity? mca_207 PHP 1 07-25-2009 11:42 AM
AJAX Made Easy - IBM Database Connectivity for JavaScript Lokesh M AJAX & XML 0 06-17-2008 03:20 PM
database connectivity anver SQL Server 2 06-13-2008 06:13 AM
About cpp connectivity govindaraj123 Mathematical Puzzles 5 08-06-2007 03:11 AM
I am getting database connectivity error sumana_i Test Director 0 04-06-2007 04:24 AM


All times are GMT -4. The time now is 01:51 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved