|
Richard Bare with me. I don't know if I know enough to ask the right questions. According to the javadocs: javax.sql.DataSource is "a factory for Connection objects. An object that implements the DataSource interface will typically be registered with a JNDI service provider. A JDBC driver that is accessed via the DataSource API does not automatically register itself with the DriverManager." So when you say "DataSource classes are specific to the driver they work with." I get confused. In Websphere there is a "Default DataSource" configured which I use to get DB connections in all my servlets. My question is how do I configure a DataSource to use 1 pool of connections across all of my servlets in Tomcat? I've tested the ConnectionPool example from the book "SERVLETS and JAVASERVER PAGESTM by Marty Hall" but it is a pool per servlet. He talks a little about a pool across the application server but doesn't give a complete example. Thanx, PLA -----Original Message----- From: owner-java400-l@midrange.com [mailto:owner-java400-l@midrange.com]On Behalf Of Richard Dettinger Sent: Wednesday, June 27, 2001 10:16 AM To: JAVA400-L@midrange.com Subject: RE: JDBC Data Source Note: when throughout this note, when I talk about there being a DataSource class (like DB2DataSource), I really mean to suggest that there is a complete suite of DataSources classes around that same base name (like DB2ConnectionPoolDataSource and all the other stuff). Which JDBC driver are you going to use? DataSource classes are specific to the driver they work with. The native JDBC driver has a DB2DataSource and DB2StdDataSource class which can be used to create connections (you would want to use DB2StdDataSource as the DB2DataSource is a non-standard variety from before there was a complete standard). I think there is a prototype of a connection pool implementation that uses them shipped with the driver, but I would suggest you build your own pool if you are going to use these (its not very hard). That is what websphere does (which is why I never wrote the complete pooling module in the first place). The Toolbox JDBC driver has an AS400JDBCDataSource class which does the same thing with toolbox connections. They also have a class called AS400ConnectionPool which is an implementation of a pool (I think). I will leave it up to someone else to explain it in more detail or you to read the javadoc for it or ask more specific questions about it. Here is something interesting though... you could probably specify the Toolbox connection property of driver=native and use the AS400JDBCDataSource class to implement a native JDBC connection pool. I don't know that it would work, but I can't see an immediate reason why it wouldn't/shouldn't. As far as running a naming service, in stand alone applications, I have always used JNDI and the fscontext support (I think that is still a seperately availble jar file). The fs stands for file system and it allows you to run JNDI over the file system. So I persist my datasource to some common IFS directory and load it from there to create the pool. Finally: I wrote a new set of data source classes for the Native JDBC driver in v5r1 which I will be discussing in an article in the September issue of News/400. They are UDBDataSource, UDBConnectionPoolDataSource, etc. They are designed to support connection and statement pooling completely transparently to the running applications that use them (read the JDBC 3.0 spec available from Sun's website if you want to learn about statement pooling and how it works). This new feature does have all the pooling support available (the pool gets created internally based on the DataSource properties). There is no XA support in this new feature yet, but that will likely be in our next release. If people are interested in seeing some of the source code for the article that creates/uses the new support, send me an e-mail and I will forward some examples to you (as I get them written, that is). There is some thought of allowing this new DataSource feature work with both Native and Toolbox JDBC drivers, but I have not done any work in that area just yet. Regards, Richard D. Dettinger AS/400 Java Data Access Team "Biologists have a special word for stability -- dead" Larry Wall Open Source Developers Journal Issue 1, Jan 2000 "Patrick L Archibald" <Patrick.Archibald@HOMETELCO.COM>@midrange.com on 06/27/2001 06:56:52 AM Please respond to JAVA400-L@midrange.com Sent by: owner-java400-l@midrange.com To: <JAVA400-L@midrange.com> cc: Subject: RE: JDBC Data Source Along the same lines as Giles, I'd like to know how to set up a DataSource connection pool in Tomcat on the AS/400. Thanx, PLA -----Original Message----- From: owner-java400-l@midrange.com [mailto:owner-java400-l@midrange.com]On Behalf Of DUCRET Gilles (GVA) Sent: Wednesday, June 27, 2001 3:25 AM To: 'JAVA400-L@midrange.com' Subject: JDBC Data Source Hi all, has anyone of you ever used the Jdbc 2 datasource feature on the as400? In this cas, how do you run/manage the naming service on the AS400 without using Websphere. With Websphere it is really easy, since you can declare this datasource. In this case i can't use websphere. Any example? Many thanks Gilles Ducret Wealth Management Division IT Architect Lloyds TSB Bank Tel: + 41 22 307 31 50 Mob: +41 79 217 21 41 ********************************************************************** This E-mail and any files transmitted with it are confidential and intended for the exclusive use of the addressee(s) only. You should not disclose its contents to any other person. If you are not the intended recipient please notify the sender immediately. ********************************************************************** +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +--- +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.