Mani Narayanan

Greenhorn
+ Follow
since Feb 20, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mani Narayanan

The easiest way to find this, put system out in your servlet initialization method for eg: init(ServletConfig) and when you call the same servlet again, check whether the system out are printed again but it won't since initialize method is called only once for every loading in the servlet container.
stop your servlet container and again start the same it will call the initialize method again
20 years ago
By setting connection pooling, one is acheiving a set of ready to use resources to access the database from the resource pool and giving it back to the pool after completing the job. Usually connection pool size should be less than the maximum connections set in your servlet engine. It has been found that lower settings (10-30 connections) perform better than higher (100+) settings. It is strongly recommended that you code your application to use at most one connection per thread. If you do code your application to require "C" concurrent database connections per thread, then your connection pool must support at least:
T * (C - 1) + 1
connections, where "T" is the maximum number of threads.
Trying changing the initial context factory class, the context factory which you have provided may work with Sun ONE App server.
Jus try out this code
//this call is the thread class where one will execute the store procedure
class DBProcess implements Runnable
{
private String sp_name;
DBProcess(String sp_name)
{
this.sp_name = sp_name
}

public void run() throws Exception
{
Connection conn = null;
CallableStatement cstmt= null;
try
{
conn = connect("Pdr");
String query = "{ call "+ sp_name+"(?) }";
cstmt = conn.prepareCall(query);
cstmt.setString(1,"PDR_USER");
cstmt.execute();
}
finally
{
if(cstmt != null)
cstmt.close();
if(conn != null)
close(conn);
}
}
}
the following is the calling class
class RunDB
{

public static void main (String[] args)
{
if (args.length > 0)
{
DBProcess db = new DBProcess (args[0]);
try
{
new Thread(db).start();
}
catch (IllegalThreadStateException e)
{
//add code
}
catch (Exception e)
{
//add code
}
}
}
}
Suppose if you close the connection object or if the connection object is a method level variable and pass only the resultset to the main method, then null object is returned. So it would be better to put it in collection object and use it for further processing