Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how do we get the connection from connection pool



how do we get the connection from connection pool..

Answer / paletipatisrinu

import java.io.*;
import java.sql.*;
inport javax.sql.*;
import javax,servlet.http.*;
public class connection extends HttpServlet
{
public void service(HttpServletRequest
req,HttpServletResponse res)throws ServletException,IOException
{
Connection con=makeConnectionPool();
Statement st =con.createStatement();

----------reqular code as like as jdbc--------









}
public void Connection makeConnectionPool()
{
Connection con=null;
try
{
InitialContext ic =new InitialContext();
DataSource ds =(DataSource)ic.lookUp(" jndi logical Name in
Application server");
con=ds.getcConnection();
}catch(Exception e)
{
e.printStackTrace();
}
return con;
}



Note:-First u create logical name of jndi in application
server and refer this api javax.sql.*

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More JDBC Interview Questions

How to connect html page to database using jdbc?

0 Answers  


How to check jdbc driver version in sql server?

0 Answers  


Under what circumstances, that all four drivers are used?

0 Answers   TCS,


What is batch processing and how to perform batch processing in jdbc?

0 Answers  


Where can I find info, frameworks and example source for writing a JDBC driver?

0 Answers  


What is java soft framework?

0 Answers  


Can the JDBC-ODBC Bridge be used with applets?

2 Answers  


How do I start debugging problems related to the JDBC API?

0 Answers  


How to rollback a JDBC transaction?

0 Answers  


What is the use of the statement in jdbc?

0 Answers  


What is use of connection pooling?

0 Answers  


How is database middleware used to access legacy databases?

1 Answers  


Categories