Please read the disclaimer at the bottom of this e-mail.
Hi,
Sorry I think I didn't explain very well. Yes that's how to do a JDBC
connection call, I've already implemented that for access to our DB2,
but I'm wanting to call AS400 APIs on the AS400, essentially a PCML
call.
I want the connection pool to return an com.ibm.as400.access.AS400
object. To do that I think I need to create a connector connection pool
in glassfish and install an AS400 resource adapter (I assume
iseriespgmcall.rar is the file I need, assuming it's JCA 1.5
compatible).
Currently, I have each application using AS400ConnectionPool to make the
default connections for me which isn't ideal.
I hope that makes sense.
Mark
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Glenn Holmer
Sent: 28 January 2010 14:57
To: Java Programming on and around the iSeries / AS400
Subject: RE: Connection pooling, JNDI and pcml
On Thu, 2010-01-28 at 14:17 +0000, Anderson, Mark wrote:
We have several java apps (approx 40) running on a glassfish cluster,
each of these apps connects to 1 of 4 as400 servers using the JTOpen
AS400ConnectionPool object. the problem is that because each
application has it's own connection pool, it's an inefficient use of
resources and can max out the number of allowed connections to the
AS400. What i'd like to do is have a connection pool that woks like a
JNDI JDBC connection pool where we have a connection pool per server
rather than a connection pool per application.
Do you mean that the apps are creating their own connection pools rather
than using pools set up in GlassFish?
I know this is possible in WebSphere using a JCA connector and i could
probably develop a solution similar to this manually but i ideally
want to use the built in support for connection pools in glassfish.
This is how we set up connection pools for an AS/400 in GlassFish 2.1.
As I recall, I learned how to do it on this list :)
1) Put jt400.jar to the lib/ subdirectory of the GlassFish install.
2) In the GlassFish admin client, navigate to Resources / JDBC /
Connection Pools, and create a new pool. Set the resource type to
javax.sql.DataSource; leave the database vendor field blank.
3) On the next panel, the datasource classname must be
com.ibm.as400.access.AS400JDBCDataSource.
4) At the bottom of the page is an area to enter additional properties;
you must enter at least servername, user, and password.
5) After saving, select the entry for this pool and click the "Ping"
button. You should see a message saying "Ping Succeeded."
6) Create a new entry under Resource / JDBC / JDBC Resources. The name
must start with jdbc/ (e.g. jdbc/myResource).
From there, it's just standard Java stuff, e.g. in web.xml:
<resource-ref>
<res-ref-name>jdbc/myResource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
And to get a connection:
InitialContext ctx = new InitialContext(); DataSource ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/myResource");
Connection conn = ds.getConnection();
--
____________________________________________________________
Glenn Holmer gholmer@xxxxxxxxxxxxxx
Software Engineer phone: 414-908-1809
Weyco Group, Inc. fax: 414-908-1601
As an Amazon Associate we earn from qualifying purchases.