|
You need to look here at who is creating the connection. As far as I can tell with AS400JDBCConnectionPool, there is no way to get a reference to the AS400JDBCConnectionPool object from an AS400JDBCPooledConnection contained in that pool. This is because there is no reference to the containing AS400JDBCConnectionPool. For these, I think you'll have to call setLibraries each time you work with the DataSource unles your AppServer tool gives you a way to set these properties ahead of time. HTH, Gary > -----Original Message----- > From: java400-l-bounces@xxxxxxxxxxxx > [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Price, Chris > Sent: Monday, May 12, 2003 1:03 AM > To: 'Java Programming on and around the iSeries / AS400' > Subject: RE: AS400 objects from a connection pool > > > Gary, > > Thanks - that's just the sort of info I was after. > > I was assuming that the Object returned by getSource() would > be the AS400 connection, but it's nice to hear some confirmation. > > > Now the next question - is it possible to do the same on a > JDBC connection pool, when it's being managed by the Web App > Server? I.e. if using JNDI to get the DataSource, how do you > get hold of the Connection Pool to attach a listener to? > > Chris > > -----Original Message----- > From: Gary L Peskin [mailto:garyp@xxxxxxxxxxxx] > Sent: 09 May 2003 16:48 > To: 'Java Programming on and around the iSeries / AS400' > Subject: RE: AS400 objects from a connection pool > > Create a class that implements ConnectionPoolListener. The > method you're going to flesh out is connectionCreated. Then, > instantiate a ConnectionPoolListener object. Pass that > object into the addConnectionPoolListener method of your > AS400ConnectionPool object. Your ConnectionPoolListener's > connectionCreated method will get called whenever a new > connection is created and placed into the connection pool. > > When your connectionCreated method is called, it is passed a > ConnectionPoolEvent. If you call the getSource() method of > the passed ConnectionPoolEvent and cast the returned value to > an AS400, you should be all set to go. > > HTH, > Gary
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.