File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC Coonection Pooling in a multithreaded Web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC Coonection Pooling in a multithreaded Web application" Watch "JDBC Coonection Pooling in a multithreaded Web application" New topic

JDBC Coonection Pooling in a multithreaded Web application

Chad Schmidt

Joined: Nov 04, 2003
Posts: 16
Hello all,
I was wondering if someone could point me in the right direction for using JDBC connection pools in a WebSphere 5.1 Web application that uses multithreading.
Here's what I am trying to do (unsuccessfully I might add)
I have a Servlet that uses an instance of a class that provides a method that creates four threads. Each one of these threads connects to an iSeries host system and searches a file in a library using a prepared SQL statement.
I was using the IBM Toolbox for Java and obtaining a Record Level access connection for each iSeries host connection but I figured I might get better connection performance out of the application by using JDBC connection pools so I ditched the Record Level Access and when with JDBC and SQL statements instead. I'm sure the search will be slower because I will no longer be taking advantage of a KeyedFile object.
I have a connection pool set up on my WDSC integrated test server. It has been tested with a non-multithreaded application and it works great. When I try to use a connection from my pool in the multithreaded application I get all sorts of messages that state that my resources can not be found.
I also get a series of messages that read:
J2CA0075W: An active transaction should be present while processing method allocateMCWrapper.
At the end of the stack trace I see an exception message that points to my prepareStatement call in my Thread class. I guess this is where the server doesn�t like what I'm doing. I don't know why though.
Does anyone know what I need to do in order to use JDBC connection pooling and CMP resources all from within a Web application that creates its own threads?
Maybe I'm going about things wrong. I would bet money on that. I am rather new to some of these advanced topics and do what I can to learn them on my own. I figure it would be dumb not to ask for help if it can save me some time or point me down the right road to success sooner.

Chad Schmidt<br />ctschmidt
I agree. Here's the link:
subject: JDBC Coonection Pooling in a multithreaded Web application
It's not a secret anymore!