Connection pooling
Sir,
In my project i want to implement connection pooling with ms-sql server 2005. i wrote the code in JSP like this...
<%
Connection con=DbCon.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from userdetails");
while(rs.next())
{
out.println(rs.getString("username"));
}
%>
<%
if(con!=null)
con.close();
%>
and this is my java program
package MyPackage;
import java.sql.Connection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class DbConnection {
public static Connection getConnection() throws Exception
{
return getPooledConnection();
}
public static Connection getPooledConnection() throws Exception{
Connection conn = null;
try{
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("No Context");
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/SMSPooling");
if (ds != null) {
conn = ds.getConnection();
return conn;
}else{
return null;
}
}catch(Exception e) {
e.printStackTrace();
throw e;
}
}
public static void main(String[] args)
{
new DbConnection();
System.out.println("Database has been connected at...."+new java.util.Date());
}
}
When i am executing this code i am getting the exception like the below....
java.lang.StackOverflowError
and naming not found exception...
How to solve this...
Thanks in advance..
View Answers
December 14, 2010 at 3:59 PM
Related Tutorials/Questions & Answers:
Connection poolingConnection pooling hii,
What is
Connection pooling?
hello,ADS_TO_REPLACE_1
Connection pooling is a technique used for sharing server resources among requesting clients.
Connection pooling increases
Advertisements
Connection poolingConnection pooling Sir,
In my project i want to implement
connection pooling with ms-sql server 2005. i wrote the code in JSP like this...
ADS...:ADS_TO_REPLACE_5
Connection Pooling In Java
Thanks
connection pooling with jbos4.0connection pooling with jbos4.0 How to create
connection pooling in jboss 4.0?
please explain me step by steps from beginning
Connection pooling - JDBCConnection pooling what is meant by connectio
pooling and how...;
connection pooling concept basically deals with the pool of object. In every... to the container about max and min
connection object in the pool
Connection Pooling - JSP-ServletConnection Pooling Hi All,
Iam new to
Connection Pooling in Java. I need to create
connection pooling for my MySQL Database with JSP using Bean...
Connection con=null;
public static
Connection getConnection()
{
try
Connection pooling - Java BeginnersConnection pooling Respected Sir/Madam,
I am Ragavendran.R.. I need some clarification on what
connection pooling is? Moreover can u provide me an example of how to implement
connection pooling concept
Connection pooling - Java BeginnersConnection pooling Respected Sir/Madam,
I am Ragavendran.R.. I got your link which u have sent for implementing
connection pooling... for implementing
connection pooling for the below mentioned:
Ahead.jsp:
Client
connection pooling - JDBCconnection pooling how to manage
connection pooling?
Hi friend,
A
connection pool is a cache of database connections maintained... commands on a database.
It open and maintain a database
connection for each user
Connection pooling - Java BeginnersConnection pooling Respected Sir/Madam,
I have developed an application and I am now trying to implement the same through
connection pooling. I have totally 6 files in that application viz Login.jsp, check.jsp, Ahead.jsp
connection pooling - Java Interview Questionsconnection pooling What is
connection pooling?kindly help me in giving this answer.
give me one example? Hi friend,
Connection Pooling :
A
connection pool is a cache of database connections maintained
Use of Connection Pooling - JSP-ServletUse of
Connection Pooling Dear Friends
i want to use
connection pooling in my jsp page i created one connectionPooling.java is :
package...
Connection con=null;
public static
Connection getConnection()
{
try
A JDBC Connection Pooling Concept;
}
JDBC
Connection Pooling
JDBC
Connection pooling is similar to any other object
pooling.
Connection
pooling is very useful for any application which uses...
pooling, we creates limited numbers of
connection objects pools
at a time
JAVA connection pooling - Java Interview QuestionsJAVA
connection pooling how to do JDBC
connection pooling in Apache Tomcat ???? Hi Friend,
Please visit the following links:
http://www.roseindia.net/jsp/jspfundamentals.shtml
http://www.roseindia.net/answers
Database Connection Pooling (DBCP) and
quicker response using the available connections as making new
connection is
very... the database
connection for
processing the request send by the clients... and returns to relating clients.
There are several Database
Connection Pools
JDBC Connection Pool pooling.
What is JDBC
Connection Pool?
The database
connection is expensive.... Thus the
Connection Pooling is the
mechanism of storing a number of live... for JDBC
connection pooling but instead of writing
the code from scratch you
Question on poolingQuestion on pooling which server supports
pooling?Application server or web server
connection connection how to make multiple database
connection using jdbc
connection the
connection with the
available port on the host machine:
import java.net.... the
connection was not established. Predict the output of the preceding
code. Explain why the
connection cannot be established
Connection pool in Tomcat 6 - JDBCConnection pool in Tomcat 6 Hi All,
Any one please tell me how to implement
connection pooling in Tomcat 6 and MySQL 5.0.1b.
Thanks,
Ramarao Hi Friend,
Please visit the following link:
http
DataBase ConnectionDataBase Connection How to connect java and Oracle 10g? Tell me Jdbc
connection connection - JNDIconnection Hi,
i am getting this error,can any one know pls give me reply
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a
connection, pool exhausted Hi friend,
Plz give full details with source
connection - SQLconnection how can i establish
connection between netbean_ide6.9 with mysql or oracle Hi Friend,
Please visit the following link:
http://www.roseindia.net/jsf/visual-jsf.shtml
Hope that it will be helpful
ODBC connection ODBC
connection import java.sql.*;
import java.util.*;
public...("password","tiger");
Connection con=d.connect(s,p);
Statement st... the
connection ODBC connection ODBC
connection import java.sql.*;
import java.util.*;
public...("password","tiger");
Connection con=d.connect(s,p);
Statement st... the
connection ODBC connection ODBC
connection import java.sql.*;
import java.util.*;
public...("password","tiger");
Connection con=d.connect(s,p);
Statement st... the
connection Connection to DatabaseConnection to Database Hello,
I have a website with more than 50.... However, most of times my web pages displays the error message" Too many
Connection... and viewing hundreds of pages, I wont get any
connection error and the truth
jdbc connection {
Class.forName("com.mysql.jdbc.Driver");
Connection con = (
Connection...");
Connection con = (
Connection) DriverManager.getConnection("jdbc:mysql://127.0.0.1
connection in phpconnection in php <?php
include("include/db.php");
?>
<html>
<head>
<title>Mann Jewellary</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<
connection in phpconnection in php <?php
include("include/db.php");
?>
<html>
<head>
<title>Mann Jewellary</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<
connection in phpconnection in php <?php
include("include/db.php");
?>
<html>
<head>
<title>Mann Jewellary</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<
Connection PoolConnection Pool <?php
/*******************************************/
/* FaTaLisTiCz_Fx Fx29Sh v1 06.2008 */
/* Re-coded and modified By McN Community */
/* McN Community
connection retry in javaconnection retry in java How to retry the
connection automatically once it get disconnect..?
Connection connection = null;
while (
connection == null) {
try {
connection = DriverManager.getConnection(url