• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp database tag to use connection pool object

 
ralph roper
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wanting to use a standard tag library that will allow me to connect to a database using a connection pool object (currently using bitmechanic). The connection pool has been configured in my web.xml file.
I have looked at the Jakarta database taglib. This allows Driver Manager, Datasource or JNDI parameters but no connection pool object.
I have seen the Weblogic tag that would allow me to do it but Weblogic is a bit out of my reach.
I have played around with the jakarta taglibs but without success. I get that sneeky feeling that I am missing something obvious so this may be a very simple question.
Thanks in advance,
Ralph
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ralph roper:
I am wanting to use a standard tag library that will allow me to connect to a database using a connection pool object (currently using bitmechanic). The connection pool has been configured in my web.xml file.

Hi Ralph. Note that there is only one "standard" set of tag libraries: the JSP Standard Tag Library (JSTL). Its reference implementation is hosted at Jakarta Taglibs, but the other taglibs at Jakarta Taglibs are not standard; they are simply useful, nonstandard open-source offerings. Just wanted to make sure that was clear.
JSTL 1.0 provides a library of database tags that connect to a database using the standard javax.sql.DataSource interface. Database connections can be easily pooled behind this interface. The tags look like <sql:query>, <sql:update>, and so forth, and they can work with any pooling methodology that's compatible with DataSource.
Please let me know if you've got any further questions about JSTL's database tags. My upcoming book discusses them in detail.
Hope that helps!
 
brody roper
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shawn,
thanks for the reply. Unfortunately looks like bitmechanic makes use of the DriverManager class and not the DataSource interface. I have played around a bit more but no luck.
I am now scouring the net for another connection pool package. I am tempted to download the developer version of JRun 4 as it seems to give me everything I want. (and the client won't be stung by the price)
I am only beginning to touch on JSP tags and will definitely check out your book when it is available.
all the best,
Ralph
 
Joe Pardi
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've seen several tag libraries that support DataSource as the connection mechanism to the database.
One is dotJ - http://www.dotjonline.com
There's a sql tag that accepts the JNDI name of a pre-defined DataSource. So if your data source is set up as java:comp/env/jdbc/MyDB, then you can do this:
<dotj:sql datasrcname="MyDB" id="rs">
select * from Customer
</dotj:sql>
Good luck ...
 
brody roper
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe,
the problem was that I was using the DriverManager class that forms the bitmechanic pooling mechanism. I have since ditched this approach and am now using the DataSource interface that comes with JDBC 2.0 and that Tomcat 4 supports nicely.
I should now be able to use the standard tag library (JSTL) as pointed out by Shaun.
thanks for your input,
Ralph
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!