ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Java J2EE  >>  Java Related  >>  JDBC
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
how do we get the connection from connection pool
 Question Submitted By :: Navaz
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how do we get the connection from connection pool
Answer
# 1
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 ?    5 Yes 0 No
Paletipatisrinu
 

 
 
 
Other JDBC Interview Questions
 
  Question Asked @ Answers
 
Hi friends, In JDBC 4 drivers are there among this which driver is best and why it is best.Which driver is most commonly used in web applications.  6
What are statements in JAVA ? CTS1
How to find that, a row is updated or not?  2
which scenarios we go for jdbc,and which scenario we go for connection polling and wat r advantages and disadvantages using connection pooling. TCS2
give me a java code snippet to connect Microsoft excel through.... I am trying alot... plz help me.  5
What is the use of prepared statement?Ans:used to execute pre compiled statement...so the question is when that precompiled statement will be execute or comiple?................ TCS5
Hi........I need to create a dropdown box using java.....this box should show the values that should be taken from the database...... Thank you....  1
Explain the different ways to register a driver?  2
Difference between Dirty, commited ,phantom,repeatable reads?  2
What type of drivers have you used?  1
i have 1000 records in resultset, how to get first 100 records from resultset, because resultset fetch all 1000 records at a time? HSBC8
how to prevent finally block from execution Bosch3
Which Driver is preferable for using JDBC API in Applets?  1
What is Statement and PreparedStatement? whatz the difference?  2
how you will execute the many tables data Wipro1
I have getting problem to calling stored procedure from Mysql through JSP. Please help me.  1
Diff. types of triggers.. Logica-CMG4
Are there any ODBC drivers that do not work with the JDBC- ODBC Bridge?  1
what is CallableStatement and what is its usage?  1
what is connection pooling? Wipro6
 
For more JDBC Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com