you mean how do you pass it forward from your servlet to your service handler?
 i can see three ways - use a static ThreadLocal (singleton) to hold the
connection and thus associate a Connection with the thread - the same thread
will be used to call the service handler at which point it can call
MyThreadSpecificConnectionHolder.get() to get the connection assigned to the
thread back out.  OR you can put the connection into the MessageContext (which
itself is stored in a ThreadLocal) using its setProperty()/getProperty()
methods to pass it forward.

tho in most cases its the service-handler's code that calls
ConnectionPool.getConnection() when the connection is needed to avoid the
overhead and additional dependency created using the above 2 methods (the
first requires that you know that your thread's specific connection is stored
in a singleton and the second requires that some string/key be used by both
your servlet and your service handler).  if your service-handler doesn't need
a connection to process the request you've created added work for yourself
that doesn't provide any return on investment.

just my $0.02 worth...
.................ron.
> Dear All:
>
> I've wrote a small servlet that extends AxisServlet.
> This home-made servlet can get database connection from our connection
> pooling mechanism.
>
> The question is : When I write the java code of my service , how can I
> get a database connection ? I find no way to send a database connection
> to my service from my own AxisServlet.
>
> Any idea ?
>
> Ken
> --
> ¬ãµo³¡             ­J­««Â             Ken Hu          [EMAIL PROTECTED]
>
> ©sµØ¬ì§ÞªÑ¥÷¦³­­¤½¥q
> http://www.mmti.com.tw
>
> °ª¶¯É]804¹ª¤s°Ï½¬®ü¸ô70¸¹
> °ê¥ß¤¤¤s¤j¾Ç³Ð·s¨|¦¨¤¤¤ß511«Ç
>
> ¹q¸Ü      07-5253020
> ¶Ç¯u      07-5252165
> ¦æ°Ê      0937083880
>
>


Reply via email to