Scott,
I didn't think about storing my connection pool in the serlvet context,
thanks for pointing that out to me.
But if I did want to use JNDI, I would just need to modify my applications
web.xml file to contain the "name" of my datasource (ie my drivers
implementation of a connection pool), and I can then retrieve it in a JSP
page as I was doing in my previous post? You mention two xml tags,
resource-ref and res-ref-name. I've looked in all my web.xml files on my
development machine, which does have a local copy of JRUN installed on it.
Where, or what reference resource, did you find those two xml tags from?
And how were you able to identify those two tags are being related to the
implementation of JNDI in JRUN (or does this apply to all JSP/servlet
servers)?
As you can tell, I really don't know much about JNDI. But I am interested
in learning more. If there are any resources that you could point me to
that go further into your suggestion of modifying the web.xml file, and the
xml tag names you need to use, I would appreciate it. Whenever I run into
these little "hurdles", I like to spend a few minutes filling in the blanks
on my knowledge when my schedule permits me to.
By the way, the three lines of code in my original post DID throw a JRUN
exception. When I did NOT attempt to cast the datasource back to my
driver's custom class, for example
DataSource dataSource1 =
(DataSource)ctx.lookup("java:comp/env/jdbc/Continental");
I got my driver's "base" class that the JDBCDataSource was derived from,
which was javax.sql.ConnectionPoolDataSource. Sorry for the confusion, I
pulled the wrong three lines of code from my test JSP page when I made my
original post.
Thanks again for the suggestions, and the information regarding modifying
the web.xml file.
Celeste
-----Original Message-----
From: Scott Stirling [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 11:36 AM
To: JRun-Talk
Subject: RE: How to Use My Driver's Connection Pool Implementation in
JRUN wit h JNDI
Hi Celeste,
I'm surprised you get a ConnectionPoolDataSource and not a
ClassCastException in the example below. That's kind of interesting.
Think of JNDI as just a system for mapping names to objects with a
simple API for adding, retrieving and removing them. As long as you
configure your named object to exist under the J2EE environment naming
context (java:comp/env), you should be able to look it up easily with
the JRun JNDI tag. To add your datasource implementation to JNDI,
configure the name mapping as a resource-ref in your app's web.xml.
When you configure the res-ref-name, keep in mind that whatever you
choose will automatically be prepended in JNDI with java:comp/env/.
Note, you might have a conflict with JRun if you try to put the name
under jdbc/. I'm not sure.
Lastly, there may be no reason to put this object in JNDI in the first
place. That's up to you. But another alternative would be just to
store an instance of your connection pool in the ServletContext and
access it that way.
Hope this helps.
Scott Stirling
Framingham, MA
> -----Original Message-----
> From: Haseltine, Celeste [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 07, 2002 11:57 AM
> To: JRun-Talk
> Subject: How to Use My Driver's Connection Pool
> Implementation in JRUN wit h JNDI
>
>
> I am currently using AveConnects JDBC driver with JRUN 3.1.
> I've discovered that when I use the JRUN Management Console
> to add a JDBC Data Source, when I retrieve the datasource
> named Continental, using
>
> <%
> net.avenir.jdbcPool.JDBCDataSource dataSource1 =
> (net.avenir.jdbcPool.JDBCDataSource)
>
> ctx.lookup("java:comp/env/jdbc/Continental");
> Connection connection = dataSource1.getConnection();
> %>
>
> that I do NOT get my driver's "custom" JDBCDataSource class,
> I get a javax.sql.ConnectionPoolDataSource (or the base class
> that my driver's JDBCDataSource class is derived from).
>
> I would like to use some of the custom methods that
> AveConnect has included with their driver, that go beyond the
> methods defined in the javax.sql.* package. I can do this by
> creating my own servlet that implements my drivers pooling
> mechanism. My problem is that I do NOT know how to "put" my
> own servelet created datasource "into" JRUN's JNDI
> implementation, or even if I can. I do NOT have the "full"
> version of JRUN, my client could only afford to purchase the
> JSP/servlet container. Therefore, I do NOT have EJB's
> enabled on my version of JRUN Server.
>
> So my question is, does anyone know if I can create my own
> datasource, and "put" it into JRUN's JNDI implementation, and
> thereby retrieve it using the JNDI JSP tags that come in the
> JRUN tag library? And can this be done without having JRUN
> enabled for EJB's?
>
> Thanks in advance for any assistance
>
> Celeste
> -------------------------------------------------
> JRUN's Implemenetation - EJB enabled versions only, or can I
> use the same Initial Context Factory to "store" my "custom"
> datasource, and then "retrieve" it using ctx.lookup()?
>
> try {
> final Properties properties = new Properties();
> properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>
> "allaire.ejipt.ContextFactory");
> properties.setProperty(Context.PROVIDER_URL,
> "ejipt://" + _host +
> ":2323");
> _context = new InitialContext(properties);
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists