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...


what is connection pooling with example?

Answers were Sorted based on User's Feedback



what is connection pooling with example?..

Answer / rakesh

Connection pooling means that connections are reused rather
than created each time a connection is requested. To
facilitate connection reuse, a memory cache of database
connections, called a connection pool, is maintained by a
connection pooling module as a layer on top of any standard
JDBC driver product.

Is This Answer Correct ?    12 Yes 0 No

what is connection pooling with example?..

Answer / dinesh

Connection pooling whic h use to Reuse the Connection
resource.To Avoid wastage of connection resources,So you
don't need to have new connection ,Instead of creating new
connection,You can use the connection from connection pool
resource
A database driver may contain a connection pool as part of
its services, through its implementation of the
javax.sql.DataSource interface. DataSource objects are used
with JNDI.

With example:
import java.sql.*;
import java.util.*;
import org.w3c.dom.*;
import DBConnectionManager;

public class XSQL {
static DBBroker pool = DBBroker.getInstance();
// <---- Pool code!

public static Element executeQuery(
String connectionName,
String statementId,
String statementText,
Document factory
)
throws SQLException
{
Connection connection = null;
DBConnection db = null;
// <---- Pool code!
try {
db = pool.getConnection(connectionName);
// <---- Pool code!
connection = db.getConnection();
// <---- Pool code!
Statement statement = connection.createStatement();
ResultSet resultSet =
statement.executeQuery(statementText);
ResultSetMetaData metaData = resultSet.getMetaData();
int columnCount = metaData.getColumnCount();

Element rowSet = factory.createElement("xsql:rowset");
rowSet.setAttribute("id", statementId);

for (int i = 0; resultSet.next(); i++) {
Element row = factory.createElement("xsql:row");
row.setAttribute("sequence", String.valueOf(i + 1));
rowSet.appendChild(row);

for (int j = 0; j &lt; columnCount; j++) {
String value = resultSet.getString(j + 1);

Element element = factory.createElement(
metaData.getColumnLabel(j + 1).toLowerCase()
);
row.appendChild(element);

if (value != null) {
element.appendChild(
factory.createTextNode(value)
);
}
}
}

resultSet.close();
statement.close();

return rowSet;
} catch (SQLException e) {
throw(new SQLException(statementText));
} finally {
if (connection != null) {
pool.releaseConnection(db); // <---- Pool code!
}
}
}

}
If u r not understand the code,If ur the beginners that
prespective to
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzaha/poolnods.htm

Is This Answer Correct ?    0 Yes 0 No

what is connection pooling with example?..

Answer / venkat

if we are using connection pooling , we can interact
database only once ,then we can place some area, then we
can reuse .

example

if we take in hibernate Ex: c3po,proxy.

these are setting to the configuration file.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Core Java Interview Questions

What one should take care of, while serializing the object?

0 Answers  


Why char array is preferred over string for storing password?

0 Answers  


Difference between array and arraylist.

23 Answers   Arise Solution, Banca Sella, iFocus, NIC, Sai Softech, Solartis, TCS, Verizon,


What is a java object and java application?

0 Answers  


What is the difference between preemptive scheduling and time slicing?

0 Answers  


what is an object class?Explain its methods?

6 Answers  


Explain the access modifiers for a class, method and variables?

0 Answers   Global Logic,


Can singleton class be inherited in java?

0 Answers  


What does %d do in java?

0 Answers  


What do you mean by platform independence of Java?

0 Answers  


Is call by reference possible in java?

0 Answers  


What is use of static in java?

0 Answers  


Categories