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

What are the utilities of the callablestatement?

0 Answers  


What are four types of JDBC driver?

0 Answers  


How do I load a database driver with JDBC 4.0 / Java 6?

0 Answers  


What does the jdbc databasemetadata interface?

0 Answers  


What happens if connection is not closed in jdbc?

0 Answers  


How do I retrieve a whole row of data at once, instead of calling an individual ResultSet.getXXX method for each column?

0 Answers  


Explain how data flows from view to db and reverse

0 Answers   Bosch,


What port does jdbc use?

0 Answers  


How to find that, a row is updated or not?

2 Answers  


How to execute bulk number of queries at once?

3 Answers   Wipro,


Which package is used for jdbc application?

0 Answers  


Explain the steps in writing a java program using jdbc?

0 Answers  


Categories