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); ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
