Please read the disclaimer at the bottom of this e-mail.
Hi james,
I've done something similar using Glassfish, I assume you will need to do something similar by replacing the sun connection holder with your app servers default connection wrapper. here's my code, hope it helps :
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400JDBCConnection;
import com.sun.gjc.spi.base.ConnectionHolder;
import java.sql.Connection;
import java.sql.SQLException;
// get a basic connection from the pool
connection = DBManager.getDB2Connection(country);
// get the connection holder
ConnectionHolder sunConn = (ConnectionHolder) connection;
AS400JDBCConnection conn = null;
try {
// extract the connection from the connection holder
conn = (AS400JDBCConnection) sunConn.getMetaData().getConnection();
} catch (SQLException ex) {
Logger.getLogger(ApiCallBean.class.getName()).log(Level.SEVERE, null, ex);
}
as400 = conn.getSystem();
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of James Perkins
Sent: 28 April 2010 16:37
To: Java Programming on and around the iSeries / AS400
Subject: Re: AS400 Object from Container Managed JDBC
I should have noted too, I'm using NetBeans in this case. It's a JSF/Facelets app and eclipse/RD(whatever you want to end it with) does not support facelets. More so, does not support auto-complete for Facelets. NetBeans does it very well, plus I like NetBeans maven support and native Mercurial support a little better :-)
--
James R. Perkins
On Wed, Apr 28, 2010 at 08:28, James Perkins <jrperkinsjr@xxxxxxxxx> wrote:
It's definitely a wrapper class. The interface is
com.ibm.websphere.rsadapter.WSDataSource, I found that by using the
java.sql.Wrapper.isWrappedFor() method.
There is a WSJdbcUtil class that has a getNativeConnection() method,
but it's deprecated in WAS 7. I also read that IBM suggests not to use
any of these classes as they are for IBM internal usage only.
I might just end up switching back to stored procedure calls. With
Java EE 5 I can get a java.sql.DataSource injected so there's no real
trouble getting an SQL connection.
Thanks for the tips!
--
James R. Perkins
Sounds like a Rational wrapper around the raw Connection object but I
could not locate the corresponding javadoc.
I would cast it to the WSJdbcDataSource class, and then investigate
the available methods on it with the usual Eclipse tools. There
might be a "getWrappedConnection" method or similar.
--
Thorbjørn Ravn Andersen "...plus... Tubular Bells!"
--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email:
JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/java400-l.
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/java400-l.
*****************************************************
Confidentiality: -
This message and any attachments are strictly confidential and may contain legally privileged information.
The contents of the transmission are intended for the named addressee(s) only. If you are not the addressee please do not read, print, store or re-transmit it or any attachments to it. Instead, please email it back to the sender and then immediately permanently delete it from your system
The views or opinions presented here are solely of the author and do not necessarily represent those of Redcats (UK) PLC or any of its subsidiaries.
Redcats (UK) plc. Registered Office: 2 Holdsworth Street, Bradford, BD1 4AH. Registered in England, No. 106691
As an Amazon Associate we earn from qualifying purchases.