Re: Database Connection

2003-07-31 Thread rajendra . x . yadav

Make sure the driver class is in classpath.

thanks
-raj



   

  Chirag Mehta   

  [EMAIL PROTECTED]To:   Struts Users Mailing List 
[EMAIL PROTECTED]  
  tanley.com  cc: 

   Subject:  Database Connection   

  31/07/2003 05:00 PM  

  Please respond to

  Struts Users Mailing

  List; Please respond

  to Chirag.Mehta  

   

   





Hello,

I have just started developing with Struts and was wondering if anyone
could help me connect to a Sybase Database using my webapp?

I have set up my JSP page, actionform and action. I have set the datasource
properies in my config.xml and am calling them from my action. It is giving
me a class not found exception like below.

java.sql.SQLException: open: java.lang.ClassNotFoundException:
com.sybase.jdbc2.jdbc.SybDriver
 at
org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:735)
 at org.apache.struts.action.ActionServlet.initModuleDataSources(Unknown
Source)
 at org.apache.struts.action.ActionServlet.init(Unknown Source)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:935)


Anyone got any ideas what i maybe ding wrong.

One other question. Does anyone know of any drivers that connect to a
informix DB and how to use them?

Sorry if this is a very basic question. I am only a first yr undergraduate!

Chirag

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





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



RE: Database Connection

2003-07-31 Thread Navjot Singh
the jar file for your sybase driver should in the class path of tha app
server.
If it's tomcat put your jar file in tomcat_home/common/lib

it will work.
-navjot singh

|-Original Message-
|From: Chirag Mehta [mailto:[EMAIL PROTECTED]
|Sent: Thursday, July 31, 2003 5:01 PM
|To: Struts Users Mailing List
|Subject: Database Connection
|
|
|Hello,
|
|I have just started developing with Struts and was wondering if
|anyone could help me connect to a Sybase Database using my webapp?
|
|I have set up my JSP page, actionform and action. I have set the
|datasource properies in my config.xml and am calling them from my
|action. It is giving me a class not found exception like below.
|
|java.sql.SQLException: open: java.lang.ClassNotFoundException:
|com.sybase.jdbc2.jdbc.SybDriver
| at
|org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:735)
| at
|org.apache.struts.action.ActionServlet.initModuleDataSources(Unknow
|n Source)
| at org.apache.struts.action.ActionServlet.init(Unknown Source)
| at javax.servlet.GenericServlet.init(GenericServlet.java:256)
| at
|org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrappe
|r.java:935)
|
|Anyone got any ideas what i maybe ding wrong.
|
|One other question. Does anyone know of any drivers that connect
|to a informix DB and how to use them?
|
|Sorry if this is a very basic question. I am only a first yr undergraduate!
|
|Chirag
|
|


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



Re: Database Connection

2003-07-31 Thread Marc Ende
Hi Navjot,

I ran into trouble as I put it in the classpath you mentioned.
(Connection works, connection works not, and so on)
I think it's better to put it in the webapps classpath, if you're not using 
jndi.

yours

Marc


Am Donnerstag, 31. Juli 2003 13:37 schrieb Navjot Singh:
 the jar file for your sybase driver should in the class path of tha app
 server.
 If it's tomcat put your jar file in tomcat_home/common/lib


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



RE: Database Connection

2003-07-31 Thread Navjot Singh
yes, you can put your class file in webapp CP also - whichever way it works
for you. However, docs say that it should be under tomcat common dir.

Can you explain a little more why/how the connection behaviour is toggling?
Did you print the state of the connection before you use it?

rgds
navjot singh

|-Original Message-
|From: Marc Ende [mailto:[EMAIL PROTECTED]
|Sent: Thursday, July 31, 2003 5:19 PM
|To: Struts Users Mailing List
|Subject: Re: Database Connection
|
|
|Hi Navjot,
|
|I ran into trouble as I put it in the classpath you mentioned.
|(Connection works, connection works not, and so on)
|I think it's better to put it in the webapps classpath, if you're
|not using
|jndi.
|
|yours
|
|Marc
|
|
|Am Donnerstag, 31. Juli 2003 13:37 schrieb Navjot Singh:
| the jar file for your sybase driver should in the class path of tha app
| server.
| If it's tomcat put your jar file in tomcat_home/common/lib
|
|
|-
|To unsubscribe, e-mail: [EMAIL PROTECTED]
|For additional commands, e-mail: [EMAIL PROTECTED]
|
|


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



Re: Database Connection

2003-07-31 Thread Marc Ende
Am Donnerstag, 31. Juli 2003 13:53 schrieb Navjot Singh:
 yes, you can put your class file in webapp CP also - whichever way it works
 for you. However, docs say that it should be under tomcat common dir.

Yes of course, they should be under tomcats common dir especially when using 
jndi for connection pooling.

 Can you explain a little more why/how the connection behaviour is toggling?
 Did you print the state of the connection before you use it?

Yes I had, but I run into trouble with sometimes open and sometimes closed 
connections. That might be no problem anymore but I've got them some month 
ago . Since this time I'm only using JNDI for connection-pooled database 
access. (It's much easyer and more efficient to use database-connections this 
way (my opinion))

Marc


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



RE: Database Connection in Logic Beans - pooling? = request cycle

2002-09-03 Thread David Graham

The request cycle ends when the final view component (JSP) sends its output 
to the browser.  Struts ends its involvement when your Action class returns 
an ActionForward object from its perform method.  Struts forwards to the 
page defined in the ActionForward object and I don't think is involved after 
that point unless your page redirects back to a struts component.

So, I would subclass the ActionServlet (the request starting point) and mark 
the time in the current session.  Then I would mark the time at the end of 
my JSP to find out how long the request took to process.

Dave


I got the message and I will use the sessionFacade pattern and use the
connection pool as you advised.
Nevertheless I would like to know where the request cycle ends in the 
struts
framework?
I didn't find any diagram regarding the request cycle.
I would like to store (among other things) the time for processing each
request.
I suppose I'll have to put the code in the controller component, the
ActionServlet?
How can I best achieve this?

Thanks to you all for your advice.
Frederic

-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 6:35 AM
To: [EMAIL PROTECTED]
Subject: RE: Database Connection in Logic Beans - pooling?


Do NOT save the request into the session.  That's why there is a connection
pool (DataSource), you take one out, use it, and put it back.  If you don't
return it you will ruin the whole point of the pool.  The connection pool
idea was created to avoid the situation you described.  You should always
ask the pool for a connection when you need one and put it back when
finished; your application's response time will greatly improve.

Dave

 Thanks to Troy,
 
 But I read a lot of Java literature and the struts archive over the past
 weeks but in the all the examples the connection is retrieved and 
returned
 is the same class. I know it is the easiest and the best way to handle 
the
 problem.
 In most cases it provides a solution.
 I would like to implement a more flexible solution:
 - Retrieving a connection and saving it in the context (request scope) or
 saving an id associated with the connection.
 - When a connection is needed in the request, look first in the context 
if
 a
 connection has already been retrieved.
 - Based on a parameter = return the connection in the class.
 - Check at the end of the request if a connection exists, if yes return 
it
 to the pool.
 = Where does the request cycle ends?
 At the source I'm a database programmer so I prefer to manage the
 transactions myself.
 I think that another advantage of using a same connection through the 
whole
 request is the fact that in case of heavy loading, when connections are
 difficult to obtain, the request can be served as a whole. I prefer X
 requests with 100% satisfaction and y not satisfied than x+y requests 
with
 30% satisfaction. If you understand what I mean?
 
 Your help or advice will be appreciated.
 Frederic
 
 I've excluded EJB for my project because most of the data is read only or
 linked to one user only.
 
 -Original Message-
 From: Troy Hart [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 02, 2002 9:17 PM
 To: Struts Users Mailing List
 Subject: RE: Database Connection in Logic Beans - pooling?
 
 
 You can solve this problem by providing a business service framework for
 your application (There has been a lot of talk about this sort of thing
 on this list...I can't think of a particular thread to reference for you
 so you may just want to go through the archives). My approach to this
 problem has been to create a set of very coarse grained business service
 components (ours is an ecommerce system so we have components like the
 following: one for cataloging, one for requisitioning, one for order
 services, and etc...), where each component provides a public API that
 mirrors the use-cases one-to-one (for the most part). I think you will
 find that the top level use-cases defined for your system provide
 natural scoping boundaries for your transactions, and resource
 management in general.
 
 This approach will leave you with a set of re-usable business components
 that are not tied to struts and/or the servlet paradigm. Also, this API
 provides an abstraction that will allow you to hide complexity from your
 struts actions (or whatever else uses the API). For example, the
 component you expose could be a facade to an EJB Session bean
 (http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.htm
l
 ).
 
 Anyway, my suggestion is to think about your problem a little
 differently. Sorry if I didn't provide enough details, my intention was
 simply to give a high level overview of how I see the problem and the
 solution. Once again, I would urge to lookup other threads on this topic
 to read what other people have said.
 
 Hope this helps,
 
 Troy
 
 
 On Mon, 2002-09-02 at 10:45, Frederic Laub wrote:
   Hi,
  
   How do achieve the following

RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread Miguel Angel Mulero Martinez

You can too use the DBCP from jakarta, I'm using it and works perfectly:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
to.html



-Mensaje original-
De: Steve McLeod [mailto:[EMAIL PROTECTED]]
Enviado el: lunes, 02 de septiembre de 2002 2:10
Para: '[EMAIL PROTECTED]'
Asunto: Database Connection in Logic Beans - pooling?

I am using:
Tomcat 4.0
Struts 1.0.2

The problem


I have successfully used the Struts database connection pooling in a
trial
web app, but as far as I can tell, a reference to the datasource can
only be
obtained from within an Action class (or directly within a JSP page but
let's not think about that today).

However I would like to have logic beans which handle database access,
rather than have this in the Action class. But I can't get a reference
to
the datasource from the logic bean because it doesn't have a
ServletContext
to which I can get a handle.

I have toyed with various ideas:
- Initialise a logic bean by passing it a reference to the Servlet
- Acquire a connection in the Action class and pass that to the bean

But really, I would rather the logic bean know inherently how to acquire
a
database connection.

My current workaround is to not use the Struts connection pooling, and
rather to manually create a connection each time database access needs
to be
done, then destroy it. But this is clearly not suitable for our
production
environment.


The context of my problem
==

I want to use some code like this in a JSP:

jsp:useBean id=abean scope=page
class=au.com.sunesis.timesheets.ClientManager /
table border=1
tr
th#/th
thClient/th
thActive/th
/tr
logic:iterate id=clientList name=abean property=clients
type=au.com.sunesis.timesheets.Client
tr
tdbean:write name=clientList property=clientID//td
tdbean:write name=clientList property=clientName//td
tdbean:write name=clientList property=active//td
/tr
/logic:iterate


The idea is that ClientManager is used to handle all general database
tasks
for the Client bean (which maps to a Client entity in the database).
ClientManager.getClients() connects to the database, creates an
ArrayList of
Client objects, one for each row in the database, and returns the
ArrayList.

ClientManager has other methods, such as:
- ClientManager.delete(Client c), which deletes the row in the
database entity corresponding to the specified client.
- ClientManager.findByPrimaryKey(int ID) which returns the
Client
which matches the specified ID
- ClientManager.save(Client c), which stores the client in the
database, creating or updating as necessary

So an Action class can also call any of these directly, and it really
shouldn't care about how these work and how they store to/retrieve from
the
database. But I can't think of the elegant way to do this and still be
able
to use the Struts connection pooling.

Any thoughts?

Thanks

Steve McLeod




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




Re: Database Connection in Logic Beans - pooling?

2002-09-02 Thread thart

Steve McLeod writes: 

 I am using:
 Tomcat 4.0
 Struts 1.0.2
  
 The problem
 
  
 I have successfully used the Struts database connection pooling in a trial
 web app, but as far as I can tell, a reference to the datasource can only be
 obtained from within an Action class (or directly within a JSP page but
 let's not think about that today).
  
 However I would like to have logic beans which handle database access,
 rather than have this in the Action class. But I can't get a reference to
 the datasource from the logic bean because it doesn't have a ServletContext
 to which I can get a handle.
  
 I have toyed with various ideas:
 - Initialise a logic bean by passing it a reference to the Servlet
 - Acquire a connection in the Action class and pass that to the bean
  
 But really, I would rather the logic bean know inherently how to acquire a
 database connection.
  
 My current workaround is to not use the Struts connection pooling, and
 rather to manually create a connection each time database access needs to be
 done, then destroy it. But this is clearly not suitable for our production
 environment.

There are a few ways to solve your problem. One way would be to bind a 
datasource to some JNDI name that your logic beans are aware of. Then, using 
that name, your logic beans can lookup the datasource completely independent 
of struts. 

Give it a try, 

Troy 

  
  
 The context of my problem
 ==
  
 I want to use some code like this in a JSP:
  
 jsp:useBean id=abean scope=page
 class=au.com.sunesis.timesheets.ClientManager /
 table border=1
 tr
 th#/th
 thClient/th
 thActive/th
 /tr
 logic:iterate id=clientList name=abean property=clients
 type=au.com.sunesis.timesheets.Client
 tr
 tdbean:write name=clientList property=clientID//td
 tdbean:write name=clientList property=clientName//td
 tdbean:write name=clientList property=active//td
 /tr
 /logic:iterate
  
  
 The idea is that ClientManager is used to handle all general database tasks
 for the Client bean (which maps to a Client entity in the database).
 ClientManager.getClients() connects to the database, creates an ArrayList of
 Client objects, one for each row in the database, and returns the ArrayList.
  
 ClientManager has other methods, such as:
 - ClientManager.delete(Client c), which deletes the row in the
 database entity corresponding to the specified client.
 - ClientManager.findByPrimaryKey(int ID) which returns the Client
 which matches the specified ID
 - ClientManager.save(Client c), which stores the client in the
 database, creating or updating as necessary
  
 So an Action class can also call any of these directly, and it really
 shouldn't care about how these work and how they store to/retrieve from the
 database. But I can't think of the elegant way to do this and still be able
 to use the Struts connection pooling.
  
 Any thoughts?
  
 Thanks
  
 Steve McLeod
  
  
  
 

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




RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread Frederic Laub

Hi,

How do achieve the following:
In some cases I want to get a connection at the beginning of a request
(request scope), pass the same connection to all the java beans that are
called in the request and return the connection at the end of the request.
Where do I put the code to return the connection to the pool at the end of
the request and in case of an error be sure that the connection is returned
to the pool?
A same connection is required when all DML statements throughout a request
are part of a same transaction.
The commit (or rollback in case of an error) statement is issued at the end
of the request before the connection is returned to the pool.
Sorry if the vocabulary I used is database oriented and not 100 %
java/struts compatible.

Your help will be appreciated.
Frederic


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 9:06 AM
To: Struts Users Mailing List
Subject: Re: Database Connection in Logic Beans - pooling?


Steve McLeod writes:

 I am using:
 Tomcat 4.0
 Struts 1.0.2

 The problem
 

 I have successfully used the Struts database connection pooling in a trial
 web app, but as far as I can tell, a reference to the datasource can only
be
 obtained from within an Action class (or directly within a JSP page but
 let's not think about that today).

 However I would like to have logic beans which handle database access,
 rather than have this in the Action class. But I can't get a reference to
 the datasource from the logic bean because it doesn't have a
ServletContext
 to which I can get a handle.

 I have toyed with various ideas:
 - Initialise a logic bean by passing it a reference to the Servlet
 - Acquire a connection in the Action class and pass that to the bean

 But really, I would rather the logic bean know inherently how to acquire a
 database connection.

 My current workaround is to not use the Struts connection pooling, and
 rather to manually create a connection each time database access needs to
be
 done, then destroy it. But this is clearly not suitable for our production
 environment.

There are a few ways to solve your problem. One way would be to bind a
datasource to some JNDI name that your logic beans are aware of. Then, using
that name, your logic beans can lookup the datasource completely independent
of struts.

Give it a try,

Troy



 The context of my problem
 ==

 I want to use some code like this in a JSP:

 jsp:useBean id=abean scope=page
 class=au.com.sunesis.timesheets.ClientManager /
 table border=1
 tr
 th#/th
 thClient/th
 thActive/th
 /tr
 logic:iterate id=clientList name=abean property=clients
 type=au.com.sunesis.timesheets.Client
 tr
 tdbean:write name=clientList property=clientID//td
 tdbean:write name=clientList property=clientName//td
 tdbean:write name=clientList property=active//td
 /tr
 /logic:iterate


 The idea is that ClientManager is used to handle all general database
tasks
 for the Client bean (which maps to a Client entity in the database).
 ClientManager.getClients() connects to the database, creates an ArrayList
of
 Client objects, one for each row in the database, and returns the
ArrayList.

 ClientManager has other methods, such as:
 - ClientManager.delete(Client c), which deletes the row in the
 database entity corresponding to the specified client.
 - ClientManager.findByPrimaryKey(int ID) which returns the Client
 which matches the specified ID
 - ClientManager.save(Client c), which stores the client in the
 database, creating or updating as necessary

 So an Action class can also call any of these directly, and it really
 shouldn't care about how these work and how they store to/retrieve from
the
 database. But I can't think of the elegant way to do this and still be
able
 to use the Struts connection pooling.

 Any thoughts?

 Thanks

 Steve McLeod





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




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




RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread Troy Hart

You can solve this problem by providing a business service framework for
your application (There has been a lot of talk about this sort of thing
on this list...I can't think of a particular thread to reference for you
so you may just want to go through the archives). My approach to this
problem has been to create a set of very coarse grained business service
components (ours is an ecommerce system so we have components like the
following: one for cataloging, one for requisitioning, one for order
services, and etc...), where each component provides a public API that
mirrors the use-cases one-to-one (for the most part). I think you will
find that the top level use-cases defined for your system provide
natural scoping boundaries for your transactions, and resource
management in general.

This approach will leave you with a set of re-usable business components
that are not tied to struts and/or the servlet paradigm. Also, this API
provides an abstraction that will allow you to hide complexity from your
struts actions (or whatever else uses the API). For example, the
component you expose could be a facade to an EJB Session bean
(http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html).

Anyway, my suggestion is to think about your problem a little
differently. Sorry if I didn't provide enough details, my intention was
simply to give a high level overview of how I see the problem and the
solution. Once again, I would urge to lookup other threads on this topic
to read what other people have said.

Hope this helps,

Troy


On Mon, 2002-09-02 at 10:45, Frederic Laub wrote:
 Hi,
 
 How do achieve the following:
 In some cases I want to get a connection at the beginning of a request
 (request scope), pass the same connection to all the java beans that are
 called in the request and return the connection at the end of the request.
 Where do I put the code to return the connection to the pool at the end of
 the request and in case of an error be sure that the connection is returned
 to the pool?
 A same connection is required when all DML statements throughout a request
 are part of a same transaction.
 The commit (or rollback in case of an error) statement is issued at the end
 of the request before the connection is returned to the pool.
 Sorry if the vocabulary I used is database oriented and not 100 %
 java/struts compatible.
 
 Your help will be appreciated.
 Frederic
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 02, 2002 9:06 AM
 To: Struts Users Mailing List
 Subject: Re: Database Connection in Logic Beans - pooling?
 
 
 Steve McLeod writes:
 
  I am using:
  Tomcat 4.0
  Struts 1.0.2
 
  The problem
  
 
  I have successfully used the Struts database connection pooling in a trial
  web app, but as far as I can tell, a reference to the datasource can only
 be
  obtained from within an Action class (or directly within a JSP page but
  let's not think about that today).
 
  However I would like to have logic beans which handle database access,
  rather than have this in the Action class. But I can't get a reference to
  the datasource from the logic bean because it doesn't have a
 ServletContext
  to which I can get a handle.
 
  I have toyed with various ideas:
  - Initialise a logic bean by passing it a reference to the Servlet
  - Acquire a connection in the Action class and pass that to the bean
 
  But really, I would rather the logic bean know inherently how to acquire a
  database connection.
 
  My current workaround is to not use the Struts connection pooling, and
  rather to manually create a connection each time database access needs to
 be
  done, then destroy it. But this is clearly not suitable for our production
  environment.
 
 There are a few ways to solve your problem. One way would be to bind a
 datasource to some JNDI name that your logic beans are aware of. Then, using
 that name, your logic beans can lookup the datasource completely independent
 of struts.
 
 Give it a try,
 
 Troy
 
 
 
  The context of my problem
  ==
 
  I want to use some code like this in a JSP:
 
  jsp:useBean id=abean scope=page
  class=au.com.sunesis.timesheets.ClientManager /
  table border=1
  tr
  th#/th
  thClient/th
  thActive/th
  /tr
  logic:iterate id=clientList name=abean property=clients
  type=au.com.sunesis.timesheets.Client
  tr
  tdbean:write name=clientList property=clientID//td
  tdbean:write name=clientList property=clientName//td
  tdbean:write name=clientList property=active//td
  /tr
  /logic:iterate
 
 
  The idea is that ClientManager is used to handle all general database
 tasks
  for the Client bean (which maps to a Client entity in the database).
  ClientManager.getClients() connects to the database, creates an ArrayList
 of
  Client objects, one for each row in the database, and returns the
 ArrayList.
 
  ClientManager

RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread Frederic Laub

Thanks to Troy,

But I read a lot of Java literature and the struts archive over the past
weeks but in the all the examples the connection is retrieved and returned
is the same class. I know it is the easiest and the best way to handle the
problem.
In most cases it provides a solution.
I would like to implement a more flexible solution:
- Retrieving a connection and saving it in the context (request scope) or
saving an id associated with the connection.
- When a connection is needed in the request, look first in the context if a
connection has already been retrieved.
- Based on a parameter = return the connection in the class.
- Check at the end of the request if a connection exists, if yes return it
to the pool.
= Where does the request cycle ends?
At the source I'm a database programmer so I prefer to manage the
transactions myself.
I think that another advantage of using a same connection through the whole
request is the fact that in case of heavy loading, when connections are
difficult to obtain, the request can be served as a whole. I prefer X
requests with 100% satisfaction and y not satisfied than x+y requests with
30% satisfaction. If you understand what I mean?

Your help or advice will be appreciated.
Frederic

I've excluded EJB for my project because most of the data is read only or
linked to one user only.

-Original Message-
From: Troy Hart [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 9:17 PM
To: Struts Users Mailing List
Subject: RE: Database Connection in Logic Beans - pooling?


You can solve this problem by providing a business service framework for
your application (There has been a lot of talk about this sort of thing
on this list...I can't think of a particular thread to reference for you
so you may just want to go through the archives). My approach to this
problem has been to create a set of very coarse grained business service
components (ours is an ecommerce system so we have components like the
following: one for cataloging, one for requisitioning, one for order
services, and etc...), where each component provides a public API that
mirrors the use-cases one-to-one (for the most part). I think you will
find that the top level use-cases defined for your system provide
natural scoping boundaries for your transactions, and resource
management in general.

This approach will leave you with a set of re-usable business components
that are not tied to struts and/or the servlet paradigm. Also, this API
provides an abstraction that will allow you to hide complexity from your
struts actions (or whatever else uses the API). For example, the
component you expose could be a facade to an EJB Session bean
(http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html
).

Anyway, my suggestion is to think about your problem a little
differently. Sorry if I didn't provide enough details, my intention was
simply to give a high level overview of how I see the problem and the
solution. Once again, I would urge to lookup other threads on this topic
to read what other people have said.

Hope this helps,

Troy


On Mon, 2002-09-02 at 10:45, Frederic Laub wrote:
 Hi,

 How do achieve the following:
 In some cases I want to get a connection at the beginning of a request
 (request scope), pass the same connection to all the java beans that are
 called in the request and return the connection at the end of the request.
 Where do I put the code to return the connection to the pool at the end of
 the request and in case of an error be sure that the connection is
returned
 to the pool?
 A same connection is required when all DML statements throughout a request
 are part of a same transaction.
 The commit (or rollback in case of an error) statement is issued at the
end
 of the request before the connection is returned to the pool.
 Sorry if the vocabulary I used is database oriented and not 100 %
 java/struts compatible.

 Your help will be appreciated.
 Frederic


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 02, 2002 9:06 AM
 To: Struts Users Mailing List
 Subject: Re: Database Connection in Logic Beans - pooling?


 Steve McLeod writes:

  I am using:
  Tomcat 4.0
  Struts 1.0.2
 
  The problem
  
 
  I have successfully used the Struts database connection pooling in a
trial
  web app, but as far as I can tell, a reference to the datasource can
only
 be
  obtained from within an Action class (or directly within a JSP page but
  let's not think about that today).
 
  However I would like to have logic beans which handle database access,
  rather than have this in the Action class. But I can't get a reference
to
  the datasource from the logic bean because it doesn't have a
 ServletContext
  to which I can get a handle.
 
  I have toyed with various ideas:
  - Initialise a logic bean by passing it a reference to the Servlet
  - Acquire a connection in the Action class and pass that to the bean
 
  But really

RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread Troy Hart

A big problem that you will encounter is reliably trapping the end of
the request lifecycle. I haven't looked at filters to see if they
provide a 100% reliable solution for this, they may (I don't know what
happens in this scenario when some component decides to redirect the
request...), or there may be some other creative solution that fits your
needs.

However, I still think the goal should be to encapsulate as much as you
can behind a re-usable business API. Struts is great but you may have a
case for re-use elsewhere. For example, you could be tasked to implement
a messaging system that asynchronously executes business logic based on
the receipt of standard documents that come in from trading partners... 

You can pass a connection to the business components if you insist, but
if the business api is done right it should naturally encapsulate the
boundaries of your transactions. Also, by passing the connection into
the business layer you have tightly coupled the controller and model
layers. However, if this buisiness API only exposes a set of value
objects then the business tier is free to swap the relational database
for an ldap store... This API could be a session facade if you were to
use EJB Session beans, but you are certainly not tied to that approach.

My advice is to take the time to get the abstractions right. Don't
couple the tiers unnecessarily, and plan for re-use. This is just my
opinion and it may or may not be relevant (I don't know your apps
requirements).

Cheers,

Troy



On Mon, 2002-09-02 at 15:02, Frederic Laub wrote:
 Thanks to Troy,
 
 But I read a lot of Java literature and the struts archive over the past
 weeks but in the all the examples the connection is retrieved and returned
 is the same class. I know it is the easiest and the best way to handle the
 problem.
 In most cases it provides a solution.
 I would like to implement a more flexible solution:
 - Retrieving a connection and saving it in the context (request scope) or
 saving an id associated with the connection.
 - When a connection is needed in the request, look first in the context if a
 connection has already been retrieved.
 - Based on a parameter = return the connection in the class.
 - Check at the end of the request if a connection exists, if yes return it
 to the pool.
 = Where does the request cycle ends?
 At the source I'm a database programmer so I prefer to manage the
 transactions myself.
 I think that another advantage of using a same connection through the whole
 request is the fact that in case of heavy loading, when connections are
 difficult to obtain, the request can be served as a whole. I prefer X
 requests with 100% satisfaction and y not satisfied than x+y requests with
 30% satisfaction. If you understand what I mean?
 
 Your help or advice will be appreciated.
 Frederic
 
 I've excluded EJB for my project because most of the data is read only or
 linked to one user only.
 
 -Original Message-
 From: Troy Hart [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 02, 2002 9:17 PM
 To: Struts Users Mailing List
 Subject: RE: Database Connection in Logic Beans - pooling?
 
 
 You can solve this problem by providing a business service framework for
 your application (There has been a lot of talk about this sort of thing
 on this list...I can't think of a particular thread to reference for you
 so you may just want to go through the archives). My approach to this
 problem has been to create a set of very coarse grained business service
 components (ours is an ecommerce system so we have components like the
 following: one for cataloging, one for requisitioning, one for order
 services, and etc...), where each component provides a public API that
 mirrors the use-cases one-to-one (for the most part). I think you will
 find that the top level use-cases defined for your system provide
 natural scoping boundaries for your transactions, and resource
 management in general.
 
 This approach will leave you with a set of re-usable business components
 that are not tied to struts and/or the servlet paradigm. Also, this API
 provides an abstraction that will allow you to hide complexity from your
 struts actions (or whatever else uses the API). For example, the
 component you expose could be a facade to an EJB Session bean
 (http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html
 ).
 
 Anyway, my suggestion is to think about your problem a little
 differently. Sorry if I didn't provide enough details, my intention was
 simply to give a high level overview of how I see the problem and the
 solution. Once again, I would urge to lookup other threads on this topic
 to read what other people have said.
 
 Hope this helps,
 
 Troy
 
 
 On Mon, 2002-09-02 at 10:45, Frederic Laub wrote:
  Hi,
 
  How do achieve the following:
  In some cases I want to get a connection at the beginning of a request
  (request scope), pass the same connection to all the java beans that are
  called

RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread David Graham

Do NOT save the request into the session.  That's why there is a connection 
pool (DataSource), you take one out, use it, and put it back.  If you don't 
return it you will ruin the whole point of the pool.  The connection pool 
idea was created to avoid the situation you described.  You should always 
ask the pool for a connection when you need one and put it back when 
finished; your application's response time will greatly improve.

Dave

Thanks to Troy,

But I read a lot of Java literature and the struts archive over the past
weeks but in the all the examples the connection is retrieved and returned
is the same class. I know it is the easiest and the best way to handle the
problem.
In most cases it provides a solution.
I would like to implement a more flexible solution:
- Retrieving a connection and saving it in the context (request scope) or
saving an id associated with the connection.
- When a connection is needed in the request, look first in the context if 
a
connection has already been retrieved.
- Based on a parameter = return the connection in the class.
- Check at the end of the request if a connection exists, if yes return it
to the pool.
= Where does the request cycle ends?
At the source I'm a database programmer so I prefer to manage the
transactions myself.
I think that another advantage of using a same connection through the whole
request is the fact that in case of heavy loading, when connections are
difficult to obtain, the request can be served as a whole. I prefer X
requests with 100% satisfaction and y not satisfied than x+y requests with
30% satisfaction. If you understand what I mean?

Your help or advice will be appreciated.
Frederic

I've excluded EJB for my project because most of the data is read only or
linked to one user only.

-Original Message-
From: Troy Hart [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 9:17 PM
To: Struts Users Mailing List
Subject: RE: Database Connection in Logic Beans - pooling?


You can solve this problem by providing a business service framework for
your application (There has been a lot of talk about this sort of thing
on this list...I can't think of a particular thread to reference for you
so you may just want to go through the archives). My approach to this
problem has been to create a set of very coarse grained business service
components (ours is an ecommerce system so we have components like the
following: one for cataloging, one for requisitioning, one for order
services, and etc...), where each component provides a public API that
mirrors the use-cases one-to-one (for the most part). I think you will
find that the top level use-cases defined for your system provide
natural scoping boundaries for your transactions, and resource
management in general.

This approach will leave you with a set of re-usable business components
that are not tied to struts and/or the servlet paradigm. Also, this API
provides an abstraction that will allow you to hide complexity from your
struts actions (or whatever else uses the API). For example, the
component you expose could be a facade to an EJB Session bean
(http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html
).

Anyway, my suggestion is to think about your problem a little
differently. Sorry if I didn't provide enough details, my intention was
simply to give a high level overview of how I see the problem and the
solution. Once again, I would urge to lookup other threads on this topic
to read what other people have said.

Hope this helps,

Troy


On Mon, 2002-09-02 at 10:45, Frederic Laub wrote:
  Hi,
 
  How do achieve the following:
  In some cases I want to get a connection at the beginning of a request
  (request scope), pass the same connection to all the java beans that are
  called in the request and return the connection at the end of the 
request.
  Where do I put the code to return the connection to the pool at the end 
of
  the request and in case of an error be sure that the connection is
returned
  to the pool?
  A same connection is required when all DML statements throughout a 
request
  are part of a same transaction.
  The commit (or rollback in case of an error) statement is issued at the
end
  of the request before the connection is returned to the pool.
  Sorry if the vocabulary I used is database oriented and not 100 %
  java/struts compatible.
 
  Your help will be appreciated.
  Frederic
 
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Monday, September 02, 2002 9:06 AM
  To: Struts Users Mailing List
  Subject: Re: Database Connection in Logic Beans - pooling?
 
 
  Steve McLeod writes:
 
   I am using:
   Tomcat 4.0
   Struts 1.0.2
  
   The problem
   
  
   I have successfully used the Struts database connection pooling in a
trial
   web app, but as far as I can tell, a reference to the datasource can
only
  be
   obtained from within an Action class (or directly within a JSP page

RE: Database Connection in Logic Beans - pooling? = request cycle

2002-09-02 Thread Frederic Laub

I got the message and I will use the sessionFacade pattern and use the
connection pool as you advised.
Nevertheless I would like to know where the request cycle ends in the struts
framework?
I didn't find any diagram regarding the request cycle.
I would like to store (among other things) the time for processing each
request.
I suppose I'll have to put the code in the controller component, the
ActionServlet?
How can I best achieve this?

Thanks to you all for your advice.
Frederic

-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 03, 2002 6:35 AM
To: [EMAIL PROTECTED]
Subject: RE: Database Connection in Logic Beans - pooling?


Do NOT save the request into the session.  That's why there is a connection
pool (DataSource), you take one out, use it, and put it back.  If you don't
return it you will ruin the whole point of the pool.  The connection pool
idea was created to avoid the situation you described.  You should always
ask the pool for a connection when you need one and put it back when
finished; your application's response time will greatly improve.

Dave

Thanks to Troy,

But I read a lot of Java literature and the struts archive over the past
weeks but in the all the examples the connection is retrieved and returned
is the same class. I know it is the easiest and the best way to handle the
problem.
In most cases it provides a solution.
I would like to implement a more flexible solution:
- Retrieving a connection and saving it in the context (request scope) or
saving an id associated with the connection.
- When a connection is needed in the request, look first in the context if
a
connection has already been retrieved.
- Based on a parameter = return the connection in the class.
- Check at the end of the request if a connection exists, if yes return it
to the pool.
= Where does the request cycle ends?
At the source I'm a database programmer so I prefer to manage the
transactions myself.
I think that another advantage of using a same connection through the whole
request is the fact that in case of heavy loading, when connections are
difficult to obtain, the request can be served as a whole. I prefer X
requests with 100% satisfaction and y not satisfied than x+y requests with
30% satisfaction. If you understand what I mean?

Your help or advice will be appreciated.
Frederic

I've excluded EJB for my project because most of the data is read only or
linked to one user only.

-Original Message-
From: Troy Hart [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 9:17 PM
To: Struts Users Mailing List
Subject: RE: Database Connection in Logic Beans - pooling?


You can solve this problem by providing a business service framework for
your application (There has been a lot of talk about this sort of thing
on this list...I can't think of a particular thread to reference for you
so you may just want to go through the archives). My approach to this
problem has been to create a set of very coarse grained business service
components (ours is an ecommerce system so we have components like the
following: one for cataloging, one for requisitioning, one for order
services, and etc...), where each component provides a public API that
mirrors the use-cases one-to-one (for the most part). I think you will
find that the top level use-cases defined for your system provide
natural scoping boundaries for your transactions, and resource
management in general.

This approach will leave you with a set of re-usable business components
that are not tied to struts and/or the servlet paradigm. Also, this API
provides an abstraction that will allow you to hide complexity from your
struts actions (or whatever else uses the API). For example, the
component you expose could be a facade to an EJB Session bean
(http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.htm
l
).

Anyway, my suggestion is to think about your problem a little
differently. Sorry if I didn't provide enough details, my intention was
simply to give a high level overview of how I see the problem and the
solution. Once again, I would urge to lookup other threads on this topic
to read what other people have said.

Hope this helps,

Troy


On Mon, 2002-09-02 at 10:45, Frederic Laub wrote:
  Hi,
 
  How do achieve the following:
  In some cases I want to get a connection at the beginning of a request
  (request scope), pass the same connection to all the java beans that are
  called in the request and return the connection at the end of the
request.
  Where do I put the code to return the connection to the pool at the end
of
  the request and in case of an error be sure that the connection is
returned
  to the pool?
  A same connection is required when all DML statements throughout a
request
  are part of a same transaction.
  The commit (or rollback in case of an error) statement is issued at the
end
  of the request before the connection is returned to the pool.
  Sorry if the vocabulary I

Re: Database Connection in Logic Beans - pooling?

2002-09-01 Thread David Graham

Here's how I do it:
I defined a Database class with a constructor that takes a Datasource 
object.  It also has a static getSystemDatabase() method and a getConnection 
method.  I subclassed the struts ActionServlet and get ahold of its 
DataSource (defined in struts-config.xml) and pass it into my Database 
object.  Then anywhere in the system I can call 
Database.getSystemDatabase().getConnection() to get a connection to the 
database.

This also works outside of webapps because the Database class just knows 
about DataSources and not struts stuff.  Also, this lets your logic beans 
not know about servlets or struts which is much cleaner in my opinion.

Hope that helps,
Dave


From: Steve McLeod [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
Subject: Database Connection in Logic Beans - pooling?
Date: Mon, 2 Sep 2002 10:09:47 +1000

I am using:
Tomcat 4.0
Struts 1.0.2

The problem


I have successfully used the Struts database connection pooling in a trial
web app, but as far as I can tell, a reference to the datasource can only 
be
obtained from within an Action class (or directly within a JSP page but
let's not think about that today).

However I would like to have logic beans which handle database access,
rather than have this in the Action class. But I can't get a reference to
the datasource from the logic bean because it doesn't have a ServletContext
to which I can get a handle.

I have toyed with various ideas:
- Initialise a logic bean by passing it a reference to the Servlet
- Acquire a connection in the Action class and pass that to the bean

But really, I would rather the logic bean know inherently how to acquire a
database connection.

My current workaround is to not use the Struts connection pooling, and
rather to manually create a connection each time database access needs to 
be
done, then destroy it. But this is clearly not suitable for our production
environment.


The context of my problem
==

I want to use some code like this in a JSP:

jsp:useBean id=abean scope=page
class=au.com.sunesis.timesheets.ClientManager /
table border=1
 tr
 th#/th
 thClient/th
 thActive/th
 /tr
logic:iterate id=clientList name=abean property=clients
type=au.com.sunesis.timesheets.Client
 tr
 tdbean:write name=clientList property=clientID//td
 tdbean:write name=clientList property=clientName//td
 tdbean:write name=clientList property=active//td
 /tr
/logic:iterate


The idea is that ClientManager is used to handle all general database tasks
for the Client bean (which maps to a Client entity in the database).
ClientManager.getClients() connects to the database, creates an ArrayList 
of
Client objects, one for each row in the database, and returns the 
ArrayList.

ClientManager has other methods, such as:
- ClientManager.delete(Client c), which deletes the row in the
database entity corresponding to the specified client.
- ClientManager.findByPrimaryKey(int ID) which returns the Client
which matches the specified ID
- ClientManager.save(Client c), which stores the client in the
database, creating or updating as necessary

So an Action class can also call any of these directly, and it really
shouldn't care about how these work and how they store to/retrieve from the
database. But I can't think of the elegant way to do this and still be able
to use the Struts connection pooling.

Any thoughts?

Thanks

Steve McLeod







_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: database connection-pool

2001-10-01 Thread C O'Connor

Its hidden away under the Utilities section on the website
http://jakarta.apache.org/struts/api/org/apache/struts/util/package-summary.html#doc.JDBC

and there's a little example of how to use it in the user guide
http://jakarta.apache.org/struts/userGuide/building_model.html#databases

should be plenty of meat there.

Caoilte O'Connor

On Mon, 1 Oct 2001, Antonio Lourinho wrote:

 Hi,
 
 i've been developing an app with Struts lately and i've reach the point
 where i just have to make the database related work in order to acomplish
 trasactional and persistence properties. To do so, i was thinking in using
 the appropriate Oracle driver, but looking at the the Struts example i see
 that there is a way to integrate a connection pool given certain parameters
 in the struts-config.xml file. Can anyone give me a link where i can read
 something more about it?
 
 Antonio - Portugal
 
 
 _
   INTERNET MAIL FOOTER 
 A presente mensagem pode conter informagco considerada confidencial.
 Se o receptor desta mensagem nco for o destinatario indicado, fica
 expressamente proibido de copiar ou enderegar a mensagem a terceiros.
 Em tal situagco, o receptor devera destruir a presente mensagem e por
 gentileza informar o emissor de tal facto.
 -
 Privileged or confidential information may be contained in this
 message. If you are not the addressee indicated in this message, you
 may not copy or deliver this message to anyone. In such case, you
 should destroy this message and kindly notify the sender by reply
 email.
 -
 
 




Re: database connection-pool

2001-10-01 Thread Craig_Reichenbach


I would look at alternatives to the generic connection pooling.  I have
found it unreliable under heavy load.  Poolman is a good alternative.
Furthermore Ted H. indicates generic pooling could be deprecated in later
releases of Struts.  It's fine for getting started but I wouldn't depend on
it.

-Craig




   

Antonio Lourinho 

alourinho@whateve   To: [EMAIL PROTECTED]  

rsoft.com   cc: (bcc: Craig 
Reichenbach/CAM/Lotus)
 Subject: database connection-pool 

10/01/2001 06:05   

AM 

Please respond to  

struts-user

   

   





Hi,

i've been developing an app with Struts lately and i've reach the point
where i just have to make the database related work in order to acomplish
trasactional and persistence properties. To do so, i was thinking in using
the appropriate Oracle driver, but looking at the the Struts example i see
that there is a way to integrate a connection pool given certain parameters
in the struts-config.xml file. Can anyone give me a link where i can read
something more about it?

Antonio - Portugal


_
  INTERNET MAIL FOOTER
A presente mensagem pode conter informação considerada confidencial.
Se o receptor desta mensagem não for o destinatário indicado, fica
expressamente proibido de copiar ou endereçar a mensagem a terceiros.
Em tal situação, o receptor deverá destruir a presente mensagem e por
gentileza informar o emissor de tal facto.
-
Privileged or confidential information may be contained in this
message. If you are not the addressee indicated in this message, you
may not copy or deliver this message to anyone. In such case, you
should destroy this message and kindly notify the sender by reply
email.
-








RE: database connection

2001-05-04 Thread Ying Teng

Yes, I can get the DataSource reference in the ServletContext object of the
ActionServlet class. But I want to get the reference to the dataSource in
the DatabaseServlet class. Can anyone tell me how to get the reference to
the dataSource from the databaseServlet class? Thanks.

Ying

-Original Message-
From: Vivek Bhaskaran [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:21 PM
To: [EMAIL PROTECTED]
Subject: Re: database connection


A reference to the DataSource is stored in the ServletContext object... You
can get it from that.

- Original Message -
From: Ying Teng [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 03, 2001 11:28 AM
Subject: RE: database connection



 What you described is true. Now my question is how to get the datasource
 without referencing the actionServlet. I wanted to intialize the database
 hashtable of the databaseServlet class in the databaseServlet init
function.
 In order to do that, I need to get the datasource. But I can not reference
 the actionServlet because the action is initialized after the database is
 initialized (as in the log file). Hope someone can give me some hints.
 Thanks.

 Ying

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 02, 2001 3:10 PM
 To: [EMAIL PROTECTED]
 Subject: RE: database connection



 You will add the key information to the datasource info in you
 struts-config.xml file  it will look like this:
 data-sources
 data-source
   key=[some name I'll use to reference this datasource]
autoCommit=false
description=Data Source Configuration
driverClass=org.gjt.mm.mysql.Driver
maxCount=4
minCount=2
password=pass

 url
 =jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass
 
user=user
 /
   /data-sources

 Then, after that's done, the easiest way to access it is to reference it
by
 the action servlet (servlet),  because using actionServlet you can just do
 servlet.findDataSource(the name you called your datasource)  and voila,
 you have your datasource object.  From that datasource object you can
 create a connection.
 If you cannot access the actionServlet, then it's a little more
 difficult--and actually I wouldn't be able to help much there, but at
least
 your question would then be how do I get the datasource without
 referencing the actionServlet

 -Dallas


























RE: database connection

2001-05-04 Thread Gogineni, Pratima

 
in the databaseservlet class do: getServletContext().getAttribute(key);
-Original Message-
From: Ying Teng
To: [EMAIL PROTECTED]
Sent: 5/4/01 8:17 AM
Subject: RE: database connection

Yes, I can get the DataSource reference in the ServletContext object of
the
ActionServlet class. But I want to get the reference to the dataSource
in
the DatabaseServlet class. Can anyone tell me how to get the reference
to
the dataSource from the databaseServlet class? Thanks.

Ying

-Original Message-
From: Vivek Bhaskaran [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:21 PM
To: [EMAIL PROTECTED]
Subject: Re: database connection


A reference to the DataSource is stored in the ServletContext object...
You
can get it from that.

- Original Message -
From: Ying Teng [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 03, 2001 11:28 AM
Subject: RE: database connection



 What you described is true. Now my question is how to get the
datasource
 without referencing the actionServlet. I wanted to intialize the
database
 hashtable of the databaseServlet class in the databaseServlet init
function.
 In order to do that, I need to get the datasource. But I can not
reference
 the actionServlet because the action is initialized after the database
is
 initialized (as in the log file). Hope someone can give me some hints.
 Thanks.

 Ying

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 02, 2001 3:10 PM
 To: [EMAIL PROTECTED]
 Subject: RE: database connection



 You will add the key information to the datasource info in you
 struts-config.xml file  it will look like this:
 data-sources
 data-source
   key=[some name I'll use to reference this datasource]
autoCommit=false
description=Data Source Configuration
driverClass=org.gjt.mm.mysql.Driver
maxCount=4
minCount=2
password=pass

 url

=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pas
s
 
user=user
 /
   /data-sources

 Then, after that's done, the easiest way to access it is to reference
it
by
 the action servlet (servlet),  because using actionServlet you can
just do
 servlet.findDataSource(the name you called your datasource)  and
voila,
 you have your datasource object.  From that datasource object you can
 create a connection.
 If you cannot access the actionServlet, then it's a little more
 difficult--and actually I wouldn't be able to help much there, but at
least
 your question would then be how do I get the datasource without
 referencing the actionServlet

 -Dallas

























RE: database connection

2001-05-04 Thread Gogineni, Pratima

 look at your web.xml file - 

you should have two servlet elements there one for DatabaseServlet and the
other for ActionServlet. each of them has a load-on-startup element.

set the load-on-startup element of the actionservlet to 1 and that of
databaseservlet to 2. to indicate that the database servlet should be loaded
first.

-Original Message-
From: Ying Teng
To: Gogineni, Pratima
Sent: 5/4/01 12:10 PM
Subject: RE: database connection

I tried that. The ServletContext object does not have that attribute. If
you
look at the servlet.log file, the system initializes the database first
and
then action, datasource. So I am wondering how to let the system
initializes
the datasourc first so in the databaseServlet class, we can have access
to
the datasource.

My idea is to enable the system to write the database info to the
database.xml file when the database is initialized.

Thanks.

-Original Message-
From: Gogineni, Pratima [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 04, 2001 3:00 PM
To: 'Ying Teng '; '[EMAIL PROTECTED] '
Subject: RE: database connection



in the databaseservlet class do: getServletContext().getAttribute(key);
-Original Message-
From: Ying Teng
To: [EMAIL PROTECTED]
Sent: 5/4/01 8:17 AM
Subject: RE: database connection

Yes, I can get the DataSource reference in the ServletContext object of
the
ActionServlet class. But I want to get the reference to the dataSource
in
the DatabaseServlet class. Can anyone tell me how to get the reference
to
the dataSource from the databaseServlet class? Thanks.

Ying

-Original Message-
From: Vivek Bhaskaran [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:21 PM
To: [EMAIL PROTECTED]
Subject: Re: database connection


A reference to the DataSource is stored in the ServletContext object...
You
can get it from that.

- Original Message -
From: Ying Teng [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 03, 2001 11:28 AM
Subject: RE: database connection



 What you described is true. Now my question is how to get the
datasource
 without referencing the actionServlet. I wanted to intialize the
database
 hashtable of the databaseServlet class in the databaseServlet init
function.
 In order to do that, I need to get the datasource. But I can not
reference
 the actionServlet because the action is initialized after the database
is
 initialized (as in the log file). Hope someone can give me some hints.
 Thanks.

 Ying

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 02, 2001 3:10 PM
 To: [EMAIL PROTECTED]
 Subject: RE: database connection



 You will add the key information to the datasource info in you
 struts-config.xml file  it will look like this:
 data-sources
 data-source
   key=[some name I'll use to reference this datasource]
autoCommit=false
description=Data Source Configuration
driverClass=org.gjt.mm.mysql.Driver
maxCount=4
minCount=2
password=pass

 url

=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pas
s
 
user=user
 /
   /data-sources

 Then, after that's done, the easiest way to access it is to reference
it
by
 the action servlet (servlet),  because using actionServlet you can
just do
 servlet.findDataSource(the name you called your datasource)  and
voila,
 you have your datasource object.  From that datasource object you can
 create a connection.
 If you cannot access the actionServlet, then it's a little more
 difficult--and actually I wouldn't be able to help much there, but at
least
 your question would then be how do I get the datasource without
 referencing the actionServlet

 -Dallas

























Re: database connection

2001-05-03 Thread Vivek Bhaskaran

A reference to the DataSource is stored in the ServletContext object... You
can get it from that.

- Original Message -
From: Ying Teng [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 03, 2001 11:28 AM
Subject: RE: database connection



 What you described is true. Now my question is how to get the datasource
 without referencing the actionServlet. I wanted to intialize the database
 hashtable of the databaseServlet class in the databaseServlet init
function.
 In order to do that, I need to get the datasource. But I can not reference
 the actionServlet because the action is initialized after the database is
 initialized (as in the log file). Hope someone can give me some hints.
 Thanks.

 Ying

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 02, 2001 3:10 PM
 To: [EMAIL PROTECTED]
 Subject: RE: database connection



 You will add the key information to the datasource info in you
 struts-config.xml file  it will look like this:
 data-sources
 data-source
   key=[some name I'll use to reference this datasource]
autoCommit=false
description=Data Source Configuration
driverClass=org.gjt.mm.mysql.Driver
maxCount=4
minCount=2
password=pass

 url
 =jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass
 
user=user
 /
   /data-sources

 Then, after that's done, the easiest way to access it is to reference it
by
 the action servlet (servlet),  because using actionServlet you can just do
 servlet.findDataSource(the name you called your datasource)  and voila,
 you have your datasource object.  From that datasource object you can
 create a connection.
 If you cannot access the actionServlet, then it's a little more
 difficult--and actually I wouldn't be able to help much there, but at
least
 your question would then be how do I get the datasource without
 referencing the actionServlet

 -Dallas

























RE: database connection

2001-05-03 Thread Ying Teng


The ServletContext object of databaseServlet or the ActionServlet? Could you
be more specific? Thanks.


-Original Message-
From: Vivek Bhaskaran [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:21 PM
To: [EMAIL PROTECTED]
Subject: Re: database connection


A reference to the DataSource is stored in the ServletContext object... You
can get it from that.

- Original Message -
From: Ying Teng [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 03, 2001 11:28 AM
Subject: RE: database connection



 What you described is true. Now my question is how to get the datasource
 without referencing the actionServlet. I wanted to intialize the database
 hashtable of the databaseServlet class in the databaseServlet init
function.
 In order to do that, I need to get the datasource. But I can not reference
 the actionServlet because the action is initialized after the database is
 initialized (as in the log file). Hope someone can give me some hints.
 Thanks.

 Ying

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 02, 2001 3:10 PM
 To: [EMAIL PROTECTED]
 Subject: RE: database connection



 You will add the key information to the datasource info in you
 struts-config.xml file  it will look like this:
 data-sources
 data-source
   key=[some name I'll use to reference this datasource]
autoCommit=false
description=Data Source Configuration
driverClass=org.gjt.mm.mysql.Driver
maxCount=4
minCount=2
password=pass

 url
 =jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass
 
user=user
 /
   /data-sources

 Then, after that's done, the easiest way to access it is to reference it
by
 the action servlet (servlet),  because using actionServlet you can just do
 servlet.findDataSource(the name you called your datasource)  and voila,
 you have your datasource object.  From that datasource object you can
 create a connection.
 If you cannot access the actionServlet, then it's a little more
 difficult--and actually I wouldn't be able to help much there, but at
least
 your question would then be how do I get the datasource without
 referencing the actionServlet

 -Dallas


























RE: database connection

2001-05-03 Thread Natra, Uday

There is only one ServletContext for the entire Web Application.


-Original Message-
From: Ying Teng [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:05 PM
To: [EMAIL PROTECTED]
Subject: RE: database connection



The ServletContext object of databaseServlet or the ActionServlet? Could you
be more specific? Thanks.


-Original Message-
From: Vivek Bhaskaran [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 5:21 PM
To: [EMAIL PROTECTED]
Subject: Re: database connection


A reference to the DataSource is stored in the ServletContext object... You
can get it from that.

- Original Message -
From: Ying Teng [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, May 03, 2001 11:28 AM
Subject: RE: database connection



 What you described is true. Now my question is how to get the datasource
 without referencing the actionServlet. I wanted to intialize the database
 hashtable of the databaseServlet class in the databaseServlet init
function.
 In order to do that, I need to get the datasource. But I can not reference
 the actionServlet because the action is initialized after the database is
 initialized (as in the log file). Hope someone can give me some hints.
 Thanks.

 Ying

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 02, 2001 3:10 PM
 To: [EMAIL PROTECTED]
 Subject: RE: database connection



 You will add the key information to the datasource info in you
 struts-config.xml file  it will look like this:
 data-sources
 data-source
   key=[some name I'll use to reference this datasource]
autoCommit=false
description=Data Source Configuration
driverClass=org.gjt.mm.mysql.Driver
maxCount=4
minCount=2
password=pass

 url
 =jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass
 
user=user
 /
   /data-sources

 Then, after that's done, the easiest way to access it is to reference it
by
 the action servlet (servlet),  because using actionServlet you can just do
 servlet.findDataSource(the name you called your datasource)  and voila,
 you have your datasource object.  From that datasource object you can
 create a connection.
 If you cannot access the actionServlet, then it's a little more
 difficult--and actually I wouldn't be able to help much there, but at
least
 your question would then be how do I get the datasource without
 referencing the actionServlet

 -Dallas

























Re: database connection

2001-05-02 Thread Donnie_Hall



Did you set up the data source configuration in your struts-config.xml file?
I'm using oracle 8.1.6, my setup looks like this.

data-sources
  data-source
 autoCommit=false
description=Data Source Configuration
driverClass=oracle.jdbc.driver.OracleDriver
   maxCount=4
   minCount=0
   password=password
 url=jdbc:oracle:thin:@name.company.net:1521:sidname
   user=username
  /
/data-sources

-Donnie Hall




|+---
||  yteng@zenimax|
||  .com |
||   |
||  05/02/2001   |
||  09:39 AM |
||  Please   |
||  respond to   |
||  struts-user  |
||   |
|+---
  |
  ||
  |   To: [EMAIL PROTECTED]   |
  |   cc: (bcc: Donnie Hall/Enron Communications)  |
  |   Subject: database connection |
  |



Hello All,

I am trying to connect to the database but when I do

DataSource dataSource =
(DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY)
;

it gives me null as the dataSource value. Can anybody help me out here?
Thanks.

Ying









RE: database connection

2001-05-02 Thread Ying Teng

Yes, I did. I use my SQL and mine looks like this:

data-sources
data-source
   autoCommit=false
   description=Data Source Configuration
   driverClass=org.gjt.mm.mysql.Driver
   maxCount=4
   minCount=2
   password=pass

url=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass

   user=user
/
  /data-sources

What else do I need to do to add this datasource to struts? Thanks.

Ying

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: Re: database connection




Did you set up the data source configuration in your struts-config.xml file?
I'm using oracle 8.1.6, my setup looks like this.

data-sources
  data-source
 autoCommit=false
description=Data Source Configuration
driverClass=oracle.jdbc.driver.OracleDriver
   maxCount=4
   minCount=0
   password=password
 url=jdbc:oracle:thin:@name.company.net:1521:sidname
   user=username
  /
/data-sources

-Donnie Hall




|+---
||  yteng@zenimax|
||  .com |
||   |
||  05/02/2001   |
||  09:39 AM |
||  Please   |
||  respond to   |
||  struts-user  |
||   |
|+---

---
-|
  |
|
  |   To: [EMAIL PROTECTED]
|
  |   cc: (bcc: Donnie Hall/Enron Communications)
|
  |   Subject: database connection
|

---
-|



Hello All,

I am trying to connect to the database but when I do

DataSource dataSource =
(DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY)
;

it gives me null as the dataSource value. Can anybody help me out here?
Thanks.

Ying










RE: database connection

2001-05-02 Thread Donnie_Hall



I'm using Tomcat 3.2.1,  when I start the server I check the log information to
verify that database connected correctly.  Try looking there.

-Donnie



|+---
||  yteng@zenimax|
||  .com |
||   |
||  05/02/2001   |
||  10:39 AM |
||  Please   |
||  respond to   |
||  struts-user  |
||   |
|+---
  |
  ||
  |   To: [EMAIL PROTECTED]   |
  |   cc: (bcc: Donnie Hall/Enron Communications)  |
  |   Subject: RE: database connection |
  |



Yes, I did. I use my SQL and mine looks like this:

data-sources
data-source
   autoCommit=false
   description=Data Source Configuration
   driverClass=org.gjt.mm.mysql.Driver
   maxCount=4
   minCount=2
   password=pass

url=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass

   user=user
/
  /data-sources

What else do I need to do to add this datasource to struts? Thanks.

Ying

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: Re: database connection




Did you set up the data source configuration in your struts-config.xml file?
I'm using oracle 8.1.6, my setup looks like this.

data-sources
  data-source
 autoCommit=false
description=Data Source Configuration
driverClass=oracle.jdbc.driver.OracleDriver
   maxCount=4
   minCount=0
   password=password
 url=jdbc:oracle:thin:@name.company.net:1521:sidname
   user=username
  /
/data-sources

-Donnie Hall




|+---
||  yteng@zenimax|
||  .com |
||   |
||  05/02/2001   |
||  09:39 AM |
||  Please   |
||  respond to   |
||  struts-user  |
||   |
|+---

---
-|
  |
|
  |   To: [EMAIL PROTECTED]
|
  |   cc: (bcc: Donnie Hall/Enron Communications)
|
  |   Subject: database connection
|

---
-|



Hello All,

I am trying to connect to the database but when I do

DataSource dataSource =
(DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY)
;

it gives me null as the dataSource value. Can anybody help me out here?
Thanks.

Ying














RE: database connection

2001-05-02 Thread Dallas_Browning


The reason why the value is null is because that is the default when you
don't specify a key value for your datasource.  When that is the case you
will obtain your connection in the following manner:



   try {
  javax.sql.DataSource dataSource = 
servlet.findDataSource(null);   
  java.sql.Connection myConnection =
dataSource.getConnection(); 


  Once again, if you want to change the value from null to something  
  else, just add  key=[something other than null]  to your datasource 
  configuration.

  Hope that helps.  

  -Dallas   






   

Ying Teng

yteng@zenimaTo: [EMAIL PROTECTED]  

x.com   cc:   

 Fax to:   

05/02/01 Subject: RE: database connection  

09:50 AM   

Please 

respond to 

struts-user

   

   





Yes, I did. I use my SQL and mine looks like this:

data-sources
data-source
   autoCommit=false
   description=Data Source Configuration
   driverClass=org.gjt.mm.mysql.Driver
   maxCount=4
   minCount=2
   password=pass

url
=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass

   user=user
/
  /data-sources

What else do I need to do to add this datasource to struts? Thanks.

Ying

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: Re: database connection




Did you set up the data source configuration in your struts-config.xml
file?
I'm using oracle 8.1.6, my setup looks like this.

data-sources
  data-source
 autoCommit=false
description=Data Source Configuration
driverClass=oracle.jdbc.driver.OracleDriver
   maxCount=4
   minCount=0
   password=password
 url=jdbc:oracle:thin:@name.company.net:1521:sidname
   user=username
  /
/data-sources

-Donnie Hall




|+---
||  yteng@zenimax|
||  .com |
||   |
||  05/02/2001   |
||  09:39 AM |
||  Please   |
||  respond to   |
||  struts-user  |
||   |
|+---


---
-|
  |
|
  |   To: [EMAIL PROTECTED]
|
  |   cc: (bcc: Donnie Hall/Enron Communications)
|
  |   Subject: database connection
|


---
-|



Hello All,

I am trying to connect to the database but when I do

DataSource dataSource =
(DataSource)servlet.getServletContext
().getAttribute(Action.DATA_SOURCE_KEY)
;

it gives me null as the dataSource value. Can

RE: database connection

2001-05-02 Thread Ying Teng

The question is how to add or specify the datasource key value. I added the
datasource tag contents in the struts-config.xml file. What else do I need
to do? Do I need add an ActionDataSource class? Do I need to use the
GenericDataSource class? Thanks.

Ying


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 12:06 PM
To: [EMAIL PROTECTED]
Subject: RE: database connection



The reason why the value is null is because that is the default when you
don't specify a key value for your datasource.  When that is the case you
will obtain your connection in the following manner:



   try {
  javax.sql.DataSource dataSource =
servlet.findDataSource(null);
  java.sql.Connection myConnection =
dataSource.getConnection();


  Once again, if you want to change the value from null to something
  else, just add  key=[something other than null]  to your datasource
  configuration.

  Hope that helps.

  -Dallas







Ying Teng
yteng@zenimaTo:
[EMAIL PROTECTED]
x.com   cc:
 Fax to:
05/02/01 Subject: RE: database
connection
09:50 AM
Please
respond to
struts-user






Yes, I did. I use my SQL and mine looks like this:

data-sources
data-source
   autoCommit=false
   description=Data Source Configuration
   driverClass=org.gjt.mm.mysql.Driver
   maxCount=4
   minCount=2
   password=pass

url
=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass

   user=user
/
  /data-sources

What else do I need to do to add this datasource to struts? Thanks.

Ying

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: Re: database connection




Did you set up the data source configuration in your struts-config.xml
file?
I'm using oracle 8.1.6, my setup looks like this.

data-sources
  data-source
 autoCommit=false
description=Data Source Configuration
driverClass=oracle.jdbc.driver.OracleDriver
   maxCount=4
   minCount=0
   password=password
 url=jdbc:oracle:thin:@name.company.net:1521:sidname
   user=username
  /
/data-sources

-Donnie Hall




|+---
||  yteng@zenimax|
||  .com |
||   |
||  05/02/2001   |
||  09:39 AM |
||  Please   |
||  respond to   |
||  struts-user  |
||   |
|+---


---
-|
  |
|
  |   To: [EMAIL PROTECTED]
|
  |   cc: (bcc: Donnie Hall/Enron Communications)
|
  |   Subject: database connection
|


---
-|



Hello All,

I am trying to connect to the database but when I do

DataSource dataSource =
(DataSource)servlet.getServletContext
().getAttribute(Action.DATA_SOURCE_KEY)
;

it gives me null as the dataSource value. Can anybody help me out here?
Thanks.

Ying















RE: database connection

2001-05-02 Thread Dallas_Browning


You will add the key information to the datasource info in you
struts-config.xml file  it will look like this:
data-sources
data-source
  key=[some name I'll use to reference this datasource]
   autoCommit=false
   description=Data Source Configuration
   driverClass=org.gjt.mm.mysql.Driver
   maxCount=4
   minCount=2
   password=pass

url
=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass

   user=user
/
  /data-sources

Then, after that's done, the easiest way to access it is to reference it by
the action servlet (servlet),  because using actionServlet you can just do
servlet.findDataSource(the name you called your datasource)  and voila,
you have your datasource object.  From that datasource object you can
create a connection.
If you cannot access the actionServlet, then it's a little more
difficult--and actually I wouldn't be able to help much there, but at least
your question would then be how do I get the datasource without
referencing the actionServlet

-Dallas


   

Ying Teng

yteng@zenimaTo: [EMAIL PROTECTED]  

x.com   cc:   

 Fax to:   

05/02/01 Subject: RE: database connection  

12:31 PM   

Please 

respond to 

struts-user

   

   





The question is how to add or specify the datasource key value. I added the
datasource tag contents in the struts-config.xml file. What else do I need
to do? Do I need add an ActionDataSource class? Do I need to use the
GenericDataSource class? Thanks.

Ying


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 12:06 PM
To: [EMAIL PROTECTED]
Subject: RE: database connection



The reason why the value is null is because that is the default when you
don't specify a key value for your datasource.  When that is the case you
will obtain your connection in the following manner:



   try {
  javax.sql.DataSource dataSource =
servlet.findDataSource(null);
  java.sql.Connection myConnection =
dataSource.getConnection();


  Once again, if you want to change the value from null to something
  else, just add  key=[something other than null]  to your datasource
  configuration.

  Hope that helps.

  -Dallas







Ying Teng
yteng@zenimaTo:
[EMAIL PROTECTED]
x.com   cc:
 Fax to:
05/02/01 Subject: RE: database
connection
09:50 AM
Please
respond to
struts-user






Yes, I did. I use my SQL and mine looks like this:

data-sources
data-source
   autoCommit=false
   description=Data Source Configuration
   driverClass=org.gjt.mm.mysql.Driver
   maxCount=4
   minCount=2
   password=pass

url
=jdbc:mysql://bethsoft.dev.zenimax.com:3306/test?user=userpassword=pass

   user=user
/
  /data-sources

What else do I need to do to add this datasource to struts? Thanks.

Ying

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: Re: database connection




Did you set up the data source configuration in your struts-config.xml
file?
I'm using oracle 8.1.6, my setup looks like this.

data-sources
  data-source
 autoCommit=false
description=Data Source Configuration
driverClass=oracle.jdbc.driver.OracleDriver
   maxCount=4
   minCount=0
   password=password
 url=jdbc:oracle:thin:@name.company.net:1521:sidname
   user=username
  /
/data-sources

-Donnie Hall




|+---
||  yteng@zenimax|
||  .com

Re: Database connection pool bug

2000-12-14 Thread Craig R. McClanahan

Howard Moore wrote:

 There appears to still be a problem with the database connection pool when
 used with the JDBC-ODBC bridge (build 20001209).

 In the close() method of org.apache.struts.util.GenericConnection the
 statement

 "conn.setTypeMap(this.map);"

 throws an UnsupportedOperationException rather than a SQLException (at least
 when used with the Microsoft SQL Server ODBC driver). Since this is not
 caught the method fails and the connection is not returned to the pool.


Grr ... I wish people would update their drivers if they implement the new JDBC
methods :-(

I will fix close() to ignore this error.

 Howard Moore

Craig McClanahan