RE: Speeding up database accesses

2001-02-06 Thread Morahg, Yoav

An excellent db connection pooling system is available at
www.javaexchange.com We have been using it for over a year and haven't had
any trouble with it. It's also fairly simple to use. Check it out.

-Yoav

-Original Message-
From: John Coonrod [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 4:27 PM
To: [EMAIL PROTECTED]
Subject: RE: Speeding up database accesses


Whoops! Over my head! Where would I learn more about how to do this?

= Original Message from [EMAIL PROTECTED] at 2/05/01 4:27 
pm
Write a connectionpool as a bean and give it the scope of application.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Speeding up database accesses

2001-02-05 Thread Wang, Jianming

Write a connectionpool as a bean and give it the scope of application.

-Original Message-
From: John Coonrod [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 4:19 PM
To: [EMAIL PROTECTED]
Subject: Speeding up database accesses


I would like to leave my oracle database connection open from one page to 
another within a session - is that possible? Is it possible to pool one 
connection for the entire webserver? If so, how? Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Speeding up database accesses

2001-02-05 Thread Randy Layman


One possibility (altough a bad idea) is to stick it into your
session.

Another possibility is to create an object that has a static
variable for the Connection.  Then provide methods to access it.  Remember
that you need to make sure only one thing at a time is using the connection.

There are some pooling connection managers out there already.  One
that I know of off the top of my head is PoolMan.  You can go over to
sourceforge.net and search for it.

Randy


-Original Message-
From: John Coonrod [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 4:19 PM
To: [EMAIL PROTECTED]
Subject: Speeding up database accesses


I would like to leave my oracle database connection open from one page to 
another within a session - is that possible? Is it possible to pool one 
connection for the entire webserver? If so, how? Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Speeding up database accesses

2001-02-05 Thread CPC Livelink Admin


While there are connection pools (I have not used them but others on the
list can point you to them), I find the easiest solution is a session
variable. Then make a function you can call with the session and db
connection info. The function checks the session for the DB varaible. If
it's not there it creates the connection and adds it to the session. Then
returns the DB. That way the call to get the connection looks nice and clean
(no nasty if statements to cloud up your HTML on the JSP).

Regards,
Paul


-Original Message-
From: John Coonrod [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 4:19 PM
To: [EMAIL PROTECTED]
Subject: Speeding up database accesses


I would like to leave my oracle database connection open from one page to
another within a session - is that possible? Is it possible to pool one
connection for the entire webserver? If so, how? Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Speeding up database accesses

2001-02-05 Thread John Coonrod

Whoops! Over my head! Where would I learn more about how to do this?

= Original Message from [EMAIL PROTECTED] at 2/05/01 4:27 
pm
Write a connectionpool as a bean and give it the scope of application.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Speeding up database accesses

2001-02-05 Thread Wang, Jianming

The following book helps, I think.
http://www.amazon.com/exec/obidos/ASIN/1884777996/qid=981408589/sr=2-2/ref=s
c_b_2/107-2595562-5791743

-Original Message-
From: John Coonrod [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 4:27 PM
To: [EMAIL PROTECTED]
Subject: RE: Speeding up database accesses


Whoops! Over my head! Where would I learn more about how to do this?

= Original Message from [EMAIL PROTECTED] at 2/05/01 4:27 
pm
Write a connectionpool as a bean and give it the scope of application.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Speeding up database accesses

2001-02-05 Thread John Golubenko

Sure it possible. For the page for example, at least you can do is
use 
---
%@ page import="java.sql.*" %
%!
Connection conn;
PreparedStatement stmt;
%

%!
public void jspInit() {
try {
String url  = "jdbc:as400://URLHERE";
String id   = "id";
String pass = "pass";

/* Making a sql string */
String sql = "SELECT xxx FROM yyy WHERE xxx = '?'";

Class.forName("com.ibm.as400.access.AS400JDBCDriver");
conn = DriverManager.getConnection(url, id, pass);
stmt = conn.prepareStatement(sql);
} catch(SQLException e) {
e.printStackTrace();
} catch(ClassNotFoundException e) {
e.printStackTrace();
}
}
%

%!
/* To close all connections when JSP is destroyed (reloaded, etc) */
public void jspDestroy() {
try {
stmt.close();
conn.close();
} catch(SQLException e) {
e.printStackTrace();
}
}
%
-

Then you can use something like  (not tested of course)
-
  String email = request.getParameter("email");
stmt.setString(1, email);
ResultSet rset = stmt.executeQuery();

-

But this is for some easy pages. If you want to driver "Yahoo" on it,
it wouldn't help... I will suggest you to take a look at PoolMan JDBC
connection pool. It works nicely here...

John.















 Original Message 

On 2/5/01, 1:18:36 PM, "John Coonrod" [EMAIL PROTECTED] wrote regarding Speeding 
up database accesses:


 I would like to leave my oracle database connection open from one page to
 another within a session - is that possible? Is it possible to pool one
 connection for the entire webserver? If so, how? Thanks.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

NOTICE:  This communication may contain confidential or other privileged information.  
If you are not the intended recipient, or believe that you have received this 
communication in error, please do not print, copy, retransmit, disseminate, or 
otherwise use the information.  Also, please indicate to the sender that you have 
received this email in error, and delete the copy you received.  Any communication 
that does not relate to official Columbia business is that of the sender and is 
neither given nor endorsed by Columbia.  Thank you.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Speeding up database accesses

2001-02-05 Thread CPC Livelink Admin


Why is it a bad idea to use a session variable?

-Original Message-
From: Randy Layman [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 3:52 PM
To: [EMAIL PROTECTED]
Subject: RE: Speeding up database accesses



One possibility (altough a bad idea) is to stick it into your
session.

Another possibility is to create an object that has a static
variable for the Connection.  Then provide methods to access it.  Remember
that you need to make sure only one thing at a time is using the connection.

There are some pooling connection managers out there already.  One
that I know of off the top of my head is PoolMan.  You can go over to
sourceforge.net and search for it.

Randy


-Original Message-
From: John Coonrod [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 4:19 PM
To: [EMAIL PROTECTED]
Subject: Speeding up database accesses


I would like to leave my oracle database connection open from one page to
another within a session - is that possible? Is it possible to pool one
connection for the entire webserver? If so, how? Thanks.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Speeding up database accesses

2001-02-05 Thread Steve Ruby



For one reason you are going to have a connection dedicated
to that session even if it isn't using it, so you will
have one connection per session when you really only need
one connection per use which is likely to be MUCH smaller, especially
considering the session doesn't die until session-timeout so you
will have a buch of lame connection sitting around takeing up
memory waiting to die..

A pool (especially a good one) will allow you to have
only the number of connections you need available to you
at any time.



CPC Livelink Admin wrote:
 
 Why is it a bad idea to use a session variable?
 
 -Original Message-
 From: Randy Layman [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 05, 2001 3:52 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Speeding up database accesses
 
 One possibility (altough a bad idea) is to stick it into your
 session.
 
 Another possibility is to create an object that has a static
 variable for the Connection.  Then provide methods to access it.  Remember
 that you need to make sure only one thing at a time is using the connection.
 
 There are some pooling connection managers out there already.  One
 that I know of off the top of my head is PoolMan.  You can go over to
 sourceforge.net and search for it.
 
 Randy
 
 -Original Message-
 From: John Coonrod [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 05, 2001 4:19 PM
 To: [EMAIL PROTECTED]
 Subject: Speeding up database accesses

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Speeding up database accesses

2001-02-05 Thread Randy Layman


I hate it when other people beat me to the responses

Basically, yes.  Another reason is that some of the JDBC drivers
taht I have worked with don't behave properly when garbage collected.
Therefore, when the session dies, the Connection would die a
garbage-collected death, sometimes leaving hanging connections.

Yet another reason is when trying to deal with the JDBC-ODBC bridge
and their problem of not handling concurrent connections.  One connection
per session makes it very difficult to limit the access.  Its much easier
where there is one class handling the the database traffic to implement this
kind of traffic cop approach, or caching, etc.

Lastly, it generally breaks the Model/View/Controller design
philisophy to include the model (database) with the view (jsp) in the same
class.

Randy


-Original Message-
From: Steve Ruby [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 4:42 PM
To: [EMAIL PROTECTED]
Subject: Re: Speeding up database accesses




For one reason you are going to have a connection dedicated
to that session even if it isn't using it, so you will
have one connection per session when you really only need
one connection per use which is likely to be MUCH smaller, especially
considering the session doesn't die until session-timeout so you
will have a buch of lame connection sitting around takeing up
memory waiting to die..

A pool (especially a good one) will allow you to have
only the number of connections you need available to you
at any time.



CPC Livelink Admin wrote:
 
 Why is it a bad idea to use a session variable?
 
 -Original Message-
 From: Randy Layman [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 05, 2001 3:52 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Speeding up database accesses
 
 One possibility (altough a bad idea) is to stick it into your
 session.
 
 Another possibility is to create an object that has a static
 variable for the Connection.  Then provide methods to access it.  Remember
 that you need to make sure only one thing at a time is using the
connection.
 
 There are some pooling connection managers out there already.  One
 that I know of off the top of my head is PoolMan.  You can go over to
 sourceforge.net and search for it.
 
 Randy
 
 -Original Message-
 From: John Coonrod [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 05, 2001 4:19 PM
 To: [EMAIL PROTECTED]
 Subject: Speeding up database accesses

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Speeding up database accesses

2001-02-05 Thread John Golubenko

Just stick with that example I gave you. OR use PoolMan. It's great 
manager!
By initializing DB connections on init(), do the job.


 Original Message 

On 2/5/01, 1:42:21 PM, "Steve Ruby" [EMAIL PROTECTED] wrote 
regarding Re: Speeding up database accesses:


 For one reason you are going to have a connection dedicated
 to that session even if it isn't using it, so you will
 have one connection per session when you really only need
 one connection per use which is likely to be MUCH smaller, especially
 considering the session doesn't die until session-timeout so you
 will have a buch of lame connection sitting around takeing up
 memory waiting to die..

 A pool (especially a good one) will allow you to have
 only the number of connections you need available to you
 at any time.



 CPC Livelink Admin wrote:
 
  Why is it a bad idea to use a session variable?
 
  -Original Message-
  From: Randy Layman [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 05, 2001 3:52 PM
  To: [EMAIL PROTECTED]
  Subject: RE: Speeding up database accesses
 
  One possibility (altough a bad idea) is to stick it into your
  session.
 
  Another possibility is to create an object that has a static
  variable for the Connection.  Then provide methods to access it.  
Remember
  that you need to make sure only one thing at a time is using the 
connection.
 
  There are some pooling connection managers out there already.  
One
  that I know of off the top of my head is PoolMan.  You can go over to
  sourceforge.net and search for it.
 
  Randy
 
  -Original Message-
  From: John Coonrod [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 05, 2001 4:19 PM
  To: [EMAIL PROTECTED]
  Subject: Speeding up database accesses

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

NOTICE:  This communication may contain confidential or other privileged information.  
If you are not the intended recipient, or believe that you have received this 
communication in error, please do not print, copy, retransmit, disseminate, or 
otherwise use the information.  Also, please indicate to the sender that you have 
received this email in error, and delete the copy you received.  Any communication 
that does not relate to official Columbia business is that of the sender and is 
neither given nor endorsed by Columbia.  Thank you.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Speeding up database accesses

2001-02-05 Thread Michael P. McCutcheon

OOpse...I meant to say that the valueUnbound method of your object will be
called...there you can close the connection...

Mike

- Original Message -
From: "Michael P. McCutcheon" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 05, 2001 6:50 PM
Subject: Re: Speeding up database accesses


 You should never rely on garbage collection to handle your connections.
 Just use the HTTPSessionBindingListener interface, and call the
valueUnbound
 when the session exipres...there you can cleanly close the connection.

 Mike


 - Original Message -
 From: "Randy Layman" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, February 05, 2001 1:13 PM
 Subject: RE: Speeding up database accesses


 
  I hate it when other people beat me to the responses
 
  Basically, yes.  Another reason is that some of the JDBC drivers
  taht I have worked with don't behave properly when garbage collected.
  Therefore, when the session dies, the Connection would die a
  garbage-collected death, sometimes leaving hanging connections.
 
  Yet another reason is when trying to deal with the JDBC-ODBC bridge
  and their problem of not handling concurrent connections.  One
connection
  per session makes it very difficult to limit the access.  Its much
easier
  where there is one class handling the the database traffic to implement
 this
  kind of traffic cop approach, or caching, etc.
 
  Lastly, it generally breaks the Model/View/Controller design
  philisophy to include the model (database) with the view (jsp) in the
same
  class.
 
  Randy
 
 
  -Original Message-
  From: Steve Ruby [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 05, 2001 4:42 PM
  To: [EMAIL PROTECTED]
  Subject: Re: Speeding up database accesses
 
 
 
 
  For one reason you are going to have a connection dedicated
  to that session even if it isn't using it, so you will
  have one connection per session when you really only need
  one connection per use which is likely to be MUCH smaller, especially
  considering the session doesn't die until session-timeout so you
  will have a buch of lame connection sitting around takeing up
  memory waiting to die..
 
  A pool (especially a good one) will allow you to have
  only the number of connections you need available to you
  at any time.
 
 
 
  CPC Livelink Admin wrote:
  
   Why is it a bad idea to use a session variable?
  
   -Original Message-
   From: Randy Layman [mailto:[EMAIL PROTECTED]]
   Sent: Monday, February 05, 2001 3:52 PM
   To: [EMAIL PROTECTED]
   Subject: RE: Speeding up database accesses
  
   One possibility (altough a bad idea) is to stick it into your
   session.
  
   Another possibility is to create an object that has a static
   variable for the Connection.  Then provide methods to access it.
 Remember
   that you need to make sure only one thing at a time is using the
  connection.
  
   There are some pooling connection managers out there already.
 One
   that I know of off the top of my head is PoolMan.  You can go over to
   sourceforge.net and search for it.
  
   Randy
  
   -Original Message-
   From: John Coonrod [mailto:[EMAIL PROTECTED]]
   Sent: Monday, February 05, 2001 4:19 PM
   To: [EMAIL PROTECTED]
   Subject: Speeding up database accesses
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED]
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED]
 
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]